File tree 2 files changed +14
-4
lines changed
packages/eslint-plugin-typescript
2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -19,10 +19,13 @@ module.exports = {
19
19
url : util . metaDocsUrl ( "no-triple-slash-reference" ) ,
20
20
} ,
21
21
schema : [ ] ,
22
+ messages : {
23
+ tripleSlashReference : "Do not use a triple slash reference." ,
24
+ } ,
22
25
} ,
23
26
24
27
create ( context ) {
25
- const referenceRegExp = / ^ \/ \s * < r e f e r e n c e / ;
28
+ const referenceRegExp = / ^ \/ \s * < r e f e r e n c e \s * p a t h = / ;
26
29
const sourceCode = context . getSourceCode ( ) ;
27
30
28
31
//----------------------------------------------------------------------
@@ -45,7 +48,7 @@ module.exports = {
45
48
if ( referenceRegExp . test ( comment . value ) ) {
46
49
context . report ( {
47
50
node : comment ,
48
- message : "Do not use a triple slash reference. " ,
51
+ messageId : "tripleSlashReference " ,
49
52
} ) ;
50
53
}
51
54
} ) ;
Original file line number Diff line number Diff line change @@ -21,15 +21,22 @@ const ruleTester = new RuleTester({
21
21
22
22
ruleTester . run ( "no-triple-slash-reference" , rule , {
23
23
valid : [
24
+ `/// <reference types="foo" />` ,
25
+ `/// <reference lib="es2017.string" />` ,
26
+ `/// <reference no-default-lib="true"/>` ,
24
27
"/// Non-reference triple-slash comment" ,
25
28
"// <reference path='Animal' />" ,
29
+ `/*
30
+ /// <reference path="Animal" />
31
+ let a
32
+ */` ,
26
33
] ,
27
34
invalid : [
28
35
{
29
36
code : '/// <reference path="Animal" />' ,
30
37
errors : [
31
38
{
32
- message : "Do not use a triple slash reference. " ,
39
+ messageId : "tripleSlashReference " ,
33
40
line : 1 ,
34
41
column : 1 ,
35
42
} ,
43
50
parser : "typescript-eslint-parser" ,
44
51
errors : [
45
52
{
46
- message : "Do not use a triple slash reference. " ,
53
+ messageId : "tripleSlashReference " ,
47
54
line : 2 ,
48
55
column : 1 ,
49
56
} ,
You can’t perform that action at this time.
0 commit comments