Commit df55137 committed Aug 11, 2024 · 4 / 4
1 parent 1cae2cb commit df55137 Copy full SHA for df55137
File tree 4 files changed +32
-4
lines changed
4 files changed +32
-4
lines changed Original file line number Diff line number Diff line change 3
3
{"gitdown": "contents", "rootId": "no-bad-blocks"}
4
4
5
5
This rule checks for multi-line-style comments which fail to meet the
6
- criteria of a jsdoc block, namely that it should begin with two and only two
7
- asterisks, but which appear to be intended as jsdoc blocks due to the presence
6
+ criteria of a JSDoc block, namely that it should begin with two and only two
7
+ asterisks, but which appear to be intended as JSDoc blocks due to the presence
8
8
of whitespace followed by whitespace or asterisks, and
9
9
an at-sign (` @ ` ) and some non-whitespace (as with a jsdoc block tag).
10
10
11
+ Exceptions are made for ESLint directive comments (which may use ` @ ` in
12
+ rule names).
13
+
11
14
## Fixer
12
15
13
16
(TODO)
Original file line number Diff line number Diff line change 5
5
6
6
7
7
This rule checks for multi-line-style comments which fail to meet the
8
- criteria of a jsdoc block, namely that it should begin with two and only two
9
- asterisks, but which appear to be intended as jsdoc blocks due to the presence
8
+ criteria of a JSDoc block, namely that it should begin with two and only two
9
+ asterisks, but which appear to be intended as JSDoc blocks due to the presence
10
10
of whitespace followed by whitespace or asterisks, and
11
11
an at-sign (` @ ` ) and some non-whitespace (as with a jsdoc block tag).
12
12
13
+ Exceptions are made for ESLint directive comments (which may use ` @ ` in
14
+ rule names).
15
+
13
16
<a name =" user-content-fixer " ></a >
14
17
<a name =" fixer " ></a >
15
18
## Fixer
@@ -170,5 +173,7 @@ function quux (foo) {
170
173
}
171
174
172
175
/***/
176
+
177
+ /* eslint-disable @stylistic/max-len */
173
178
````
174
179
Original file line number Diff line number Diff line change @@ -31,6 +31,16 @@ export default iterateJsdoc(({
31
31
allComments
32
32
) . filter ( ( comment ) => {
33
33
const commentText = sourceCode . getText ( comment ) ;
34
+
35
+ const initialText = commentText . replace ( commentRegexp , '' ) . trimStart ( ) ;
36
+ if ( [
37
+ 'eslint'
38
+ ] . some ( ( directive ) => {
39
+ return initialText . startsWith ( directive ) ;
40
+ } ) ) {
41
+ return false ;
42
+ }
43
+
34
44
let sliceIndex = 2 ;
35
45
if ( ! commentRegexp . test ( commentText ) ) {
36
46
const multiline = extraAsteriskCommentRegexp . exec ( commentText ) ?. [ 0 ] ;
Original file line number Diff line number Diff line change @@ -250,5 +250,15 @@ export default {
250
250
{
251
251
code : '/***/' ,
252
252
} ,
253
+ {
254
+ code : '/* eslint-disable @stylistic/max-len */' ,
255
+ plugins : {
256
+ '@stylistic' : {
257
+ rules : {
258
+ 'max-len' : ( ) => { }
259
+ }
260
+ }
261
+ } ,
262
+ } ,
253
263
] ,
254
264
} ;
You can’t perform that action at this time.
0 commit comments