File tree Expand file tree Collapse file tree 4 files changed +54
-0
lines changed Expand file tree Collapse file tree 4 files changed +54
-0
lines changed Original file line number Diff line number Diff line change 1
1
/* eslint-disable import/max-dependencies */
2
2
import checkExamples from './rules/checkExamples' ;
3
+ import checkIndentation from './rules/checkIndentation' ;
3
4
import checkParamNames from './rules/checkParamNames' ;
4
5
import checkTagNames from './rules/checkTagNames' ;
5
6
import checkTypes from './rules/checkTypes' ;
@@ -24,6 +25,7 @@ export default {
24
25
recommended : {
25
26
rules : {
26
27
'jsdoc/check-examples' : 'off' ,
28
+ 'jsdoc/check-indentation' : 'off' ,
27
29
'jsdoc/check-param-names' : 'warn' ,
28
30
'jsdoc/check-tag-names' : 'warn' ,
29
31
'jsdoc/check-types' : 'warn' ,
@@ -47,6 +49,7 @@ export default {
47
49
} ,
48
50
rules : {
49
51
'check-examples' : checkExamples ,
52
+ 'check-indentation' : checkIndentation ,
50
53
'check-param-names' : checkParamNames ,
51
54
'check-tag-names' : checkTagNames ,
52
55
'check-types' : checkTypes ,
Original file line number Diff line number Diff line change
1
+ import iterateJsdoc from '../iterateJsdoc' ;
2
+
3
+ export default iterateJsdoc ( ( {
4
+ sourceCode,
5
+ jsdocNode,
6
+ report
7
+ } ) => {
8
+ const reg = new RegExp ( / ^ [ \t ] + \* [ \t ] { 2 } / m) ;
9
+ const text = sourceCode . getText ( jsdocNode ) ;
10
+ if ( reg . test ( text ) ) {
11
+ report ( 'There must be no indentation.' ) ;
12
+ }
13
+ } ) ;
Original file line number Diff line number Diff line change
1
+ export default {
2
+ invalid : [
3
+ {
4
+ code : `
5
+ /**
6
+ * foo
7
+ *
8
+ * @param bar
9
+ * baz
10
+ */
11
+ function quux () {
12
+
13
+ }
14
+ ` ,
15
+ errors : [
16
+ {
17
+ message : 'There must be no indentation.'
18
+ }
19
+ ]
20
+ }
21
+ ] ,
22
+ valid : [
23
+ {
24
+ code : `
25
+ /**
26
+ * foo
27
+ *
28
+ * @param bar
29
+ * baz
30
+ */
31
+ function quux () {
32
+
33
+ }
34
+ `
35
+ }
36
+ ]
37
+ } ;
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ const ruleTester = new RuleTester();
8
8
9
9
_ . forEach ( [
10
10
'check-examples' ,
11
+ 'check-indentation' ,
11
12
'check-param-names' ,
12
13
'check-tag-names' ,
13
14
'check-types' ,
You can’t perform that action at this time.
0 commit comments