mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-26 09:52:11 +03:00
build(lint): fix false-positive any matching in comments and add t11 validator to husky pre-commit hook
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
npx lint-staged
|
||||
node scripts/check-docs-sync.mjs
|
||||
npm run check:any-budget:t11
|
||||
npm run test:unit
|
||||
|
||||
@@ -110,7 +110,10 @@ for (const item of budget) {
|
||||
}
|
||||
|
||||
const content = fs.readFileSync(absolutePath, "utf8");
|
||||
const matches = content.match(anyRegex);
|
||||
// Remove block and line comments to avoid false positives with the word "any" in comments
|
||||
let cleanContent = content.replace(/\/\*[\s\S]*?\*\//g, "");
|
||||
cleanContent = cleanContent.replace(/\/\/.*$/gm, "");
|
||||
const matches = cleanContent.match(anyRegex);
|
||||
const count = matches ? matches.length : 0;
|
||||
const status = count <= item.maxAny ? "OK" : "FAIL";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user