@storm-software/eslint-plugin-banner 0.0.25 → 0.0.27
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/index.mjs
CHANGED
package/dist/plugin.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as plugin } from "./plugin-
|
|
1
|
+
import { t as plugin } from "./plugin-CumoPR7l.mjs";
|
|
2
2
|
export { plugin };
|
package/dist/rules/banner.mjs
CHANGED
|
@@ -21,7 +21,7 @@ function excludeShebangs(comments) {
|
|
|
21
21
|
*/
|
|
22
22
|
function getLeadingComments(context, node) {
|
|
23
23
|
const firstBodyNode = Array.isArray(node.body) && node.body.length ? node.body[0] : node;
|
|
24
|
-
const all = excludeShebangs(context.getSourceCode().getAllComments(firstBodyNode));
|
|
24
|
+
const all = excludeShebangs((context.sourceCode || context.getSourceCode()).getAllComments(firstBodyNode));
|
|
25
25
|
if (!all.length) return [];
|
|
26
26
|
if (all[0] && all[0].type.toLowerCase() === "block") return [all[0]];
|
|
27
27
|
let i = 1;
|
|
@@ -29,7 +29,7 @@ function getLeadingComments(context, node) {
|
|
|
29
29
|
const prev = all[i - 1];
|
|
30
30
|
const current = all[i];
|
|
31
31
|
if (!prev || !current) break;
|
|
32
|
-
if (!context.getSourceCode().getText().slice(prev.range[1], current.range[0]).match(/^(\r\n|\r|\n)$/)) break;
|
|
32
|
+
if (!(context.sourceCode || context.getSourceCode()).getText().slice(prev.range[1], current.range[0]).match(/^(\r\n|\r|\n)$/)) break;
|
|
33
33
|
}
|
|
34
34
|
return all.slice(0, i);
|
|
35
35
|
}
|
|
@@ -42,7 +42,7 @@ function genCommentsRange(context, comments, eol) {
|
|
|
42
42
|
if (!comments[0]) return [0, 0];
|
|
43
43
|
const start = comments[0].range[0];
|
|
44
44
|
let end = comments.slice(-1)[0]?.range[1] ?? start;
|
|
45
|
-
if (context.getSourceCode().text[end] === eol) end += eol.length;
|
|
45
|
+
if ((context.sourceCode || context.getSourceCode()).text[end] === eol) end += eol.length;
|
|
46
46
|
return [start, end];
|
|
47
47
|
}
|
|
48
48
|
function genPrependFixer(commentStyle, node, bannerLines, eol, newlines) {
|
|
@@ -167,7 +167,7 @@ var banner_default = createRule({
|
|
|
167
167
|
let fixLines = bannerLines;
|
|
168
168
|
return { Program(node) {
|
|
169
169
|
const normalizedNewlines = newlines ?? 1;
|
|
170
|
-
if (!hasBanner(normalizedCommentStyle, context.sourceCode.getText(), eol)) context.report({
|
|
170
|
+
if (!hasBanner(normalizedCommentStyle, (context.sourceCode || context.getSourceCode()).getText(), eol)) context.report({
|
|
171
171
|
loc: node.loc,
|
|
172
172
|
messageId: "missingBanner",
|
|
173
173
|
fix: genPrependFixer(normalizedCommentStyle, node, fixLines, eol, normalizedNewlines)
|
|
@@ -218,7 +218,7 @@ var banner_default = createRule({
|
|
|
218
218
|
}
|
|
219
219
|
const lastLeadingComment = leadingComments[bannerLines.length - 1] ?? leadingComments[leadingComments.length - 1];
|
|
220
220
|
if (!lastLeadingComment) return;
|
|
221
|
-
if (!matchesLineEndings(context.sourceCode.text.substr(lastLeadingComment.range[1], normalizedNewlines * 2), normalizedNewlines)) context.report({
|
|
221
|
+
if (!matchesLineEndings((context.sourceCode || context.getSourceCode()).text.substr(lastLeadingComment.range[1], normalizedNewlines * 2), normalizedNewlines)) context.report({
|
|
222
222
|
loc: node.loc,
|
|
223
223
|
messageId: "noNewlineAfterBanner",
|
|
224
224
|
fix: genReplaceFixer(normalizedCommentStyle, context, leadingComments, fixLines, eol, normalizedNewlines)
|
|
@@ -238,7 +238,7 @@ var banner_default = createRule({
|
|
|
238
238
|
messageId: "incorrectBanner",
|
|
239
239
|
fix: genReplaceFixer(normalizedCommentStyle, context, leadingComments, fixLines, eol, normalizedNewlines)
|
|
240
240
|
});
|
|
241
|
-
} else if (!matchesLineEndings(context.sourceCode.text.substr(firstLeadingComment.range[1], normalizedNewlines * 2), normalizedNewlines)) context.report({
|
|
241
|
+
} else if (!matchesLineEndings((context.sourceCode || context.getSourceCode()).text.substr(firstLeadingComment.range[1], normalizedNewlines * 2), normalizedNewlines)) context.report({
|
|
242
242
|
loc: node.loc,
|
|
243
243
|
messageId: "noNewlineAfterBanner",
|
|
244
244
|
fix: genReplaceFixer(normalizedCommentStyle, context, leadingComments, fixLines, eol, normalizedNewlines)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storm-software/eslint-plugin-banner",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.27",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "An ESLint Plugin that enforces the existence of file banners in Storm Software projects.",
|
|
6
6
|
"keywords": ["eslint", "eslint-plugin", "storm-software"],
|
|
@@ -53,14 +53,14 @@
|
|
|
53
53
|
"typings": "dist/index.d.mts",
|
|
54
54
|
"files": ["dist", "docs"],
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@storm-software/package-constants": "0.1.
|
|
56
|
+
"@storm-software/package-constants": "0.1.75",
|
|
57
57
|
"@typescript-eslint/utils": "^8.61.0",
|
|
58
58
|
"defu": "^6.1.7"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@eslint/compat": "^2.1.0",
|
|
62
62
|
"@eslint/config-inspector": "^1.5.0",
|
|
63
|
-
"@storm-software/prettier": "0.59.
|
|
63
|
+
"@storm-software/prettier": "0.59.115",
|
|
64
64
|
"@types/eslint": "^9.6.1",
|
|
65
65
|
"@types/eslint__js": "^8.42.3",
|
|
66
66
|
"@types/node": "^25.9.3",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"peerDependencies": { "eslint": ">=9.39.3" },
|
|
77
77
|
"peerDependenciesMeta": { "eslint": { "optional": false } },
|
|
78
78
|
"publishConfig": { "access": "public" },
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "b6da2d24e56e885c36947d4888e1a6380c1907b8"
|
|
80
80
|
}
|