@commitlint/lint
Advanced tools
@@ -5,4 +5,4 @@ export const buildCommitMessage = ({ header, body, footer, }) => { | ||
| message = footer ? `${message}\n\n${footer}` : message; | ||
| return message || ''; | ||
| return message || ""; | ||
| }; | ||
| //# sourceMappingURL=commit-message.js.map |
+1
-1
@@ -1,3 +0,3 @@ | ||
| import type { LintOptions, LintOutcome, QualifiedRules } from '@commitlint/types'; | ||
| import type { LintOptions, LintOutcome, QualifiedRules } from "@commitlint/types"; | ||
| export default function lint(message: string, rawRulesConfig?: QualifiedRules, rawOpts?: LintOptions): Promise<LintOutcome>; | ||
| //# sourceMappingURL=lint.d.ts.map |
+15
-15
@@ -1,7 +0,7 @@ | ||
| import util from 'node:util'; | ||
| import isIgnored from '@commitlint/is-ignored'; | ||
| import parse from '@commitlint/parse'; | ||
| import defaultRules from '@commitlint/rules'; | ||
| import { RuleConfigSeverity } from '@commitlint/types'; | ||
| import { buildCommitMessage } from './commit-message.js'; | ||
| import util from "node:util"; | ||
| import isIgnored from "@commitlint/is-ignored"; | ||
| import parse from "@commitlint/parse"; | ||
| import defaultRules from "@commitlint/rules"; | ||
| import { RuleConfigSeverity } from "@commitlint/types"; | ||
| import { buildCommitMessage } from "./commit-message.js"; | ||
| export default async function lint(message, rawRulesConfig, rawOpts) { | ||
@@ -22,3 +22,3 @@ const opts = rawOpts | ||
| // Parse the commit message | ||
| const parsed = message === '' | ||
| const parsed = message === "" | ||
| ? { header: null, body: null, footer: null } | ||
@@ -46,9 +46,9 @@ : await parse(message, undefined, opts.parserOpts); | ||
| // Find invalid rules configs | ||
| const missing = Object.keys(rulesConfig).filter((name) => typeof allRules.get(name) !== 'function'); | ||
| const missing = Object.keys(rulesConfig).filter((name) => typeof allRules.get(name) !== "function"); | ||
| if (missing.length > 0) { | ||
| const names = [...allRules.keys()]; | ||
| throw new RangeError([ | ||
| `Found rules without implementation: ${missing.join(', ')}.`, | ||
| `Supported rules are: ${names.join(', ')}.`, | ||
| ].join('\n')); | ||
| `Found rules without implementation: ${missing.join(", ")}.`, | ||
| `Supported rules are: ${names.join(", ")}.`, | ||
| ].join("\n")); | ||
| } | ||
@@ -65,3 +65,3 @@ const invalid = Object.entries(rulesConfig) | ||
| const [, when] = config; | ||
| if (typeof level !== 'number' || isNaN(level)) { | ||
| if (typeof level !== "number" || isNaN(level)) { | ||
| return new Error(`level for rule ${name} must be number, received ${util.inspect(level)} of type ${typeof level}`); | ||
@@ -75,6 +75,6 @@ } | ||
| } | ||
| if (typeof when !== 'string') { | ||
| if (typeof when !== "string") { | ||
| return new Error(`condition for rule ${name} must be string, received ${util.inspect(when)} of type ${typeof when}`); | ||
| } | ||
| if (when !== 'never' && when !== 'always') { | ||
| if (when !== "never" && when !== "always") { | ||
| return new Error(`condition for rule ${name} must be "always" or "never", received ${util.inspect(when)}`); | ||
@@ -86,3 +86,3 @@ } | ||
| if (invalid.length > 0) { | ||
| throw new Error(invalid.map((i) => i.message).join('\n')); | ||
| throw new Error(invalid.map((i) => i.message).join("\n")); | ||
| } | ||
@@ -89,0 +89,0 @@ // Validate against all rules |
+8
-8
| { | ||
| "name": "@commitlint/lint", | ||
| "type": "module", | ||
| "version": "19.8.0", | ||
| "version": "19.8.1", | ||
| "description": "Lint a string against commitlint rules", | ||
@@ -39,12 +39,12 @@ "main": "lib/lint.js", | ||
| "devDependencies": { | ||
| "@commitlint/test": "^19.8.0", | ||
| "@commitlint/utils": "^19.8.0" | ||
| "@commitlint/test": "^19.8.1", | ||
| "@commitlint/utils": "^19.8.1" | ||
| }, | ||
| "dependencies": { | ||
| "@commitlint/is-ignored": "^19.8.0", | ||
| "@commitlint/parse": "^19.8.0", | ||
| "@commitlint/rules": "^19.8.0", | ||
| "@commitlint/types": "^19.8.0" | ||
| "@commitlint/is-ignored": "^19.8.1", | ||
| "@commitlint/parse": "^19.8.1", | ||
| "@commitlint/rules": "^19.8.1", | ||
| "@commitlint/types": "^19.8.1" | ||
| }, | ||
| "gitHead": "e82f05a737626bb69979d14564f5ff601997f679" | ||
| "gitHead": "3c302008cabeb0b08cd246b2417a51a9d745a918" | ||
| } |
Sorry, the diff of this file is not supported yet
Updated
Updated
Updated