@commitlint/is-ignored
Advanced tools
+1
-10
| import { wildcards } from './defaults.js'; | ||
| import { validateIgnoreFunction } from './validate-ignore-func.js'; | ||
| export default function isIgnored(commit = '', opts = {}) { | ||
@@ -8,4 +7,2 @@ const ignores = typeof opts.ignores === 'undefined' ? [] : opts.ignores; | ||
| } | ||
| // Validate ignore functions | ||
| ignores.forEach(validateIgnoreFunction); | ||
| const invalids = ignores.filter((c) => typeof c !== 'function'); | ||
@@ -18,10 +15,4 @@ if (invalids.length > 0) { | ||
| const base = opts.defaults === false ? [] : wildcards; | ||
| return [...base, ...ignores].some((w) => { | ||
| const result = w(commit); | ||
| if (typeof result !== 'boolean') { | ||
| throw new Error(`Ignore function must return a boolean, received ${typeof result}`); | ||
| } | ||
| return result; | ||
| }); | ||
| return [...base, ...ignores].some((w) => w(commit)); | ||
| } | ||
| //# sourceMappingURL=is-ignored.js.map |
+6
-6
| { | ||
| "name": "@commitlint/is-ignored", | ||
| "type": "module", | ||
| "version": "19.7.1", | ||
| "version": "19.8.0", | ||
| "description": "Lint your commit messages", | ||
@@ -39,12 +39,12 @@ "main": "lib/index.js", | ||
| "devDependencies": { | ||
| "@commitlint/parse": "^19.5.0", | ||
| "@commitlint/test": "^19.5.0", | ||
| "@commitlint/utils": "^19.5.0", | ||
| "@commitlint/parse": "^19.8.0", | ||
| "@commitlint/test": "^19.8.0", | ||
| "@commitlint/utils": "^19.8.0", | ||
| "@types/semver": "^7.5.7" | ||
| }, | ||
| "dependencies": { | ||
| "@commitlint/types": "^19.5.0", | ||
| "@commitlint/types": "^19.8.0", | ||
| "semver": "^7.6.0" | ||
| }, | ||
| "gitHead": "b0e851c73ccd6c71f4f0f16af370e566c773f43c" | ||
| "gitHead": "e82f05a737626bb69979d14564f5ff601997f679" | ||
| } |
| import { Matcher } from '@commitlint/types'; | ||
| export declare function validateIgnoreFunction(fn: Matcher): void; | ||
| //# sourceMappingURL=validate-ignore-func.d.ts.map |
| {"version":3,"file":"validate-ignore-func.d.ts","sourceRoot":"","sources":["../src/validate-ignore-func.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,mBAAmB,CAAC;AAE1C,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,OAAO,QAajD"} |
| export function validateIgnoreFunction(fn) { | ||
| const fnString = fn.toString(); | ||
| // Check for dangerous patterns | ||
| const dangerousPattern = /(?:process|require|import|eval|fetch|XMLHttpRequest|fs|child_process)(?:\s*\.|\s*\()|(?:exec|execFile|spawn)\s*\(/; | ||
| if (dangerousPattern.test(fnString)) { | ||
| // Find which pattern matched for a more specific error message | ||
| const match = fnString.match(dangerousPattern); | ||
| throw new Error(`Ignore function contains forbidden pattern: ${match?.[0].trim()}`); | ||
| } | ||
| } | ||
| //# sourceMappingURL=validate-ignore-func.js.map |
| {"version":3,"file":"validate-ignore-func.js","sourceRoot":"","sources":["../src/validate-ignore-func.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,sBAAsB,CAAC,EAAW;IACjD,MAAM,QAAQ,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;IAE/B,+BAA+B;IAC/B,MAAM,gBAAgB,GACrB,mHAAmH,CAAC;IACrH,IAAI,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QACrC,+DAA+D;QAC/D,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;QAC/C,MAAM,IAAI,KAAK,CACd,+CAA+C,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAClE,CAAC;IACH,CAAC;AACF,CAAC"} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
0
-100%6914
-23.03%14
-22.22%45
-31.82%Updated