File tree Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ interface IPlugin {
14
14
rules : { [ x : string ] : eslint . Rule . RuleModule } ;
15
15
}
16
16
17
- export const plugin : IPlugin = {
17
+ const plugin : IPlugin = {
18
18
rules : {
19
19
"syntax" : {
20
20
meta : {
@@ -31,16 +31,13 @@ export const plugin: IPlugin = {
31
31
const tsDocParser : TSDocParser = new TSDocParser ( ) ;
32
32
const sourceCode : eslint . SourceCode = context . getSourceCode ( ) ;
33
33
const checkCommentBlocks : ( node : ESTree . Node ) => void = function ( node : ESTree . Node ) {
34
- const commentBlocks : ESTree . Comment [ ] = sourceCode . getCommentsBefore ( node ) . filter ( function ( comment : ESTree . Comment ) {
35
- return comment . type === "Block" ;
36
- } ) ;
37
- if ( commentBlocks . length > 0 ) {
38
- const commentBlock : ESTree . Comment = commentBlocks [ 0 ] ;
39
- const commentString : string = "/*" + commentBlock . value + "*/" ;
34
+ const commentToken : eslint . AST . Token | null = sourceCode . getJSDocComment ( node ) ;
35
+ if ( commentToken ) {
36
+ const commentString : string = "/*" + commentToken . value + "*/" ;
40
37
const results : ParserMessageLog = tsDocParser . parseString ( commentString ) . log ;
41
38
for ( const message of results . messages ) {
42
39
context . report ( {
43
- node : node ,
40
+ loc : commentToken . loc ,
44
41
messageId : message . messageId ,
45
42
data : {
46
43
unformattedText : message . unformattedText
@@ -58,3 +55,5 @@ export const plugin: IPlugin = {
58
55
}
59
56
}
60
57
}
58
+
59
+ export = plugin ;
Original file line number Diff line number Diff line change 1
1
2
2
import { RuleTester } from "eslint" ;
3
- import { plugin } from "../index" ;
3
+ import * as plugin from "../index" ;
4
4
5
5
const ruleTester : RuleTester = new RuleTester ( {
6
6
env : {
You can’t perform that action at this time.
0 commit comments