@bemoje/eslint 2.1.1 → 2.1.2
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/README.md +2 -0
- package/lib/index.cjs +7 -1
- package/lib/index.d.cts +2 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +7 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -101,3 +101,5 @@ export function add(a: number, b: number) {
|
|
|
101
101
|
```
|
|
102
102
|
|
|
103
103
|
Single-line block comments and line comments between the block comment and the declaration are ignored.
|
|
104
|
+
|
|
105
|
+
A file's header is left alone: the block comment that nothing comes before (a shebang line aside) is about the file, so it keeps the blank line after it.
|
package/lib/index.cjs
CHANGED
|
@@ -32,6 +32,12 @@ var noBlankLineBetweenCommentAndDeclaration = createRule({
|
|
|
32
32
|
if (Math.abs(comment.loc.start.line - comment.loc.end.line) < 2) {
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
|
+
const before = context.sourceCode.getTokenBefore(comment, {
|
|
36
|
+
includeComments: true
|
|
37
|
+
});
|
|
38
|
+
if (!before || before.type === "Shebang") {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
35
41
|
const nextToken = context.sourceCode.getTokenAfter(comment, {
|
|
36
42
|
includeComments: true
|
|
37
43
|
});
|
|
@@ -153,7 +159,7 @@ function eslintPluginBemoje() {
|
|
|
153
159
|
},
|
|
154
160
|
meta: {
|
|
155
161
|
name: "eslint-plugin-bemoje",
|
|
156
|
-
version: "2.1.
|
|
162
|
+
version: "2.1.2"
|
|
157
163
|
},
|
|
158
164
|
rules
|
|
159
165
|
};
|
package/lib/index.d.cts
CHANGED
|
@@ -60,7 +60,8 @@ interface EslintPluginBemoje extends PluginForEslint {
|
|
|
60
60
|
declare function eslintPluginBemoje(): EslintPluginBemoje;
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
|
-
* Enforce no blank lines between block comments and the next declaration.
|
|
63
|
+
* Enforce no blank lines between block comments and the next declaration. A file's header, the comment that nothing
|
|
64
|
+
* comes before, is left alone.
|
|
64
65
|
*/
|
|
65
66
|
declare const noBlankLineBetweenCommentAndDeclaration: _typescript_eslint_utils_ts_eslint.RuleModule<"no-blank-line-between-comment-and-declaration", [string], {
|
|
66
67
|
description: string;
|
package/lib/index.d.ts
CHANGED
|
@@ -60,7 +60,8 @@ interface EslintPluginBemoje extends PluginForEslint {
|
|
|
60
60
|
declare function eslintPluginBemoje(): EslintPluginBemoje;
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
|
-
* Enforce no blank lines between block comments and the next declaration.
|
|
63
|
+
* Enforce no blank lines between block comments and the next declaration. A file's header, the comment that nothing
|
|
64
|
+
* comes before, is left alone.
|
|
64
65
|
*/
|
|
65
66
|
declare const noBlankLineBetweenCommentAndDeclaration: _typescript_eslint_utils_ts_eslint.RuleModule<"no-blank-line-between-comment-and-declaration", [string], {
|
|
66
67
|
description: string;
|
package/lib/index.js
CHANGED
|
@@ -30,6 +30,12 @@ var noBlankLineBetweenCommentAndDeclaration = createRule({
|
|
|
30
30
|
if (Math.abs(comment.loc.start.line - comment.loc.end.line) < 2) {
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
|
+
const before = context.sourceCode.getTokenBefore(comment, {
|
|
34
|
+
includeComments: true
|
|
35
|
+
});
|
|
36
|
+
if (!before || before.type === "Shebang") {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
33
39
|
const nextToken = context.sourceCode.getTokenAfter(comment, {
|
|
34
40
|
includeComments: true
|
|
35
41
|
});
|
|
@@ -151,7 +157,7 @@ function eslintPluginBemoje() {
|
|
|
151
157
|
},
|
|
152
158
|
meta: {
|
|
153
159
|
name: "eslint-plugin-bemoje",
|
|
154
|
-
version: "2.1.
|
|
160
|
+
version: "2.1.2"
|
|
155
161
|
},
|
|
156
162
|
rules
|
|
157
163
|
};
|