@checkdigit/eslint-plugin 7.13.0-PR.57-8dbb → 7.13.0-PR.57-e6c4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-mjs/no-util.mjs +9 -17
- package/package.json +1 -1
- package/src/no-util.ts +10 -16
package/dist-mjs/no-util.mjs
CHANGED
|
@@ -21,24 +21,16 @@ var rule = createRule({
|
|
|
21
21
|
return {
|
|
22
22
|
Program() {
|
|
23
23
|
const filename = context.filename;
|
|
24
|
-
const firstLine = context.sourceCode.getLines()[0];
|
|
25
|
-
if (firstLine === void 0) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
const actualComment = firstLine.split("// ")[1];
|
|
29
|
-
if (actualComment?.startsWith(DISABLE_NEXT_LINE) === true) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
24
|
const utilRegex = /(?:^|[-_/])util(?=[-_./]|$)/iu;
|
|
33
25
|
if (utilRegex.test(filename)) {
|
|
34
|
-
context.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
}
|
|
26
|
+
const filePathComment = context.sourceCode.getAllComments().find((comment) => !comment.value.includes(DISABLE_NEXT_LINE));
|
|
27
|
+
if (filePathComment !== void 0) {
|
|
28
|
+
context.report({
|
|
29
|
+
messageId: NO_UTIL,
|
|
30
|
+
data: { filename },
|
|
31
|
+
node: filePathComment
|
|
32
|
+
});
|
|
33
|
+
}
|
|
42
34
|
}
|
|
43
35
|
}
|
|
44
36
|
};
|
|
@@ -49,4 +41,4 @@ export {
|
|
|
49
41
|
no_util_default as default,
|
|
50
42
|
ruleId
|
|
51
43
|
};
|
|
52
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
44
|
+
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vc3JjL25vLXV0aWwudHMiXSwKICAib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":"7.13.0-PR.57-
|
|
1
|
+
{"name":"@checkdigit/eslint-plugin","version":"7.13.0-PR.57-e6c4","description":"Check Digit eslint plugins","keywords":["eslint","eslintplugin"],"homepage":"https://github.com/checkdigit/eslint-plugin#readme","bugs":{"url":"https://github.com/checkdigit/eslint-plugin/issues"},"repository":{"type":"git","url":"https://github.com/checkdigit/eslint-plugin"},"license":"MIT","author":"Check Digit, LLC","sideEffects":false,"type":"module","exports":{".":{"types":"./dist-types/index.d.ts","import":"./dist-mjs/index.mjs","default":"./dist-mjs/index.mjs"}},"files":["src","dist-types","dist-mjs","!src/**/test/**","!src/**/*.test.ts","!src/**/*.spec.ts","!dist-types/**/test/**","!dist-types/**/*.test.d.ts","!dist-types/**/*.spec.d.ts","!dist-mjs/**/test/**","!dist-mjs/**/*.test.mjs","!dist-mjs/**/*.spec.mjs","SECURITY.md"],"scripts":{"build:dist-mjs":"rimraf dist-mjs && npx builder --type=module --sourceMap --outDir=dist-mjs && node dist-mjs/index.mjs","build:dist-types":"rimraf dist-types && npx builder --type=types --outDir=dist-types","ci:compile":"tsc --noEmit","ci:coverage":"NODE_OPTIONS=\"--disable-warning ExperimentalWarning --experimental-vm-modules\" jest --coverage=true","ci:lint":"npm run lint","ci:style":"npm run prettier","ci:test":"NODE_OPTIONS=\"--disable-warning ExperimentalWarning --experimental-vm-modules\" jest --coverage=false","lint":"eslint --max-warnings 0 .","lint:fix":"eslint --max-warnings 0 --fix .","prepare":"","prepublishOnly":"npm run build:dist-types && npm run build:dist-mjs","prettier":"prettier --ignore-path .gitignore --list-different .","prettier:fix":"prettier --ignore-path .gitignore --write .","test":"npm run ci:compile && npm run ci:test && npm run ci:lint && npm run ci:style"},"prettier":"@checkdigit/prettier-config","jest":{"preset":"@checkdigit/jest-config"},"dependencies":{"@typescript-eslint/type-utils":"^8.23.0","@typescript-eslint/utils":"^8.23.0","http-status-codes":"^2.3.0","ts-api-utils":"^2.0.1"},"devDependencies":{"@checkdigit/jest-config":"^6.0.2","@checkdigit/prettier-config":"^6.1.0","@checkdigit/typescript-config":"^9.0.0","@eslint/js":"^9.19.0","@types/eslint":"^9.6.1","@types/eslint-config-prettier":"^6.11.3","@typescript-eslint/parser":"^8.23.0","@typescript-eslint/rule-tester":"^8.23.0","eslint":"^9.19.0","eslint-config-prettier":"^10.0.1","eslint-import-resolver-typescript":"^3.7.0","eslint-plugin-eslint-plugin":"^6.4.0","eslint-plugin-import":"^2.31.0","eslint-plugin-no-only-tests":"^3.3.0","eslint-plugin-no-secrets":"^2.2.1","eslint-plugin-node":"^11.1.0","eslint-plugin-sonarjs":"1.0.4","rimraf":"^6.0.1","typescript-eslint":"^8.23.0"},"peerDependencies":{"eslint":">=9 <10"},"engines":{"node":">=22.11"}}
|
package/src/no-util.ts
CHANGED
|
@@ -31,24 +31,18 @@ const rule: ESLintUtils.RuleModule<typeof NO_UTIL> = createRule({
|
|
|
31
31
|
return {
|
|
32
32
|
Program() {
|
|
33
33
|
const filename = context.filename;
|
|
34
|
-
const firstLine = context.sourceCode.getLines()[0];
|
|
35
|
-
if (firstLine === undefined) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
const actualComment = firstLine.split('// ')[1];
|
|
39
|
-
if (actualComment?.startsWith(DISABLE_NEXT_LINE) === true) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
34
|
const utilRegex = /(?:^|[-_/])util(?=[-_./]|$)/iu;
|
|
43
35
|
if (utilRegex.test(filename)) {
|
|
44
|
-
context.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
36
|
+
const filePathComment = context.sourceCode
|
|
37
|
+
.getAllComments()
|
|
38
|
+
.find((comment) => !comment.value.includes(DISABLE_NEXT_LINE));
|
|
39
|
+
if (filePathComment !== undefined) {
|
|
40
|
+
context.report({
|
|
41
|
+
messageId: NO_UTIL,
|
|
42
|
+
data: { filename },
|
|
43
|
+
node: filePathComment,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
52
46
|
}
|
|
53
47
|
},
|
|
54
48
|
};
|