@@ -13,7 +13,7 @@ import { ASTUtils, TSESTree } from '@typescript-eslint/experimental-utils';
13
13
14
14
export const RULE_NAME = 'no-debug' ;
15
15
export type MessageIds = 'noDebug' ;
16
- type Options = [ { utilNames : string [ ] } ] ;
16
+ type Options = [ { utilNames : Array < 'debug' | 'logTestingPlaygroundURL' > } ] ;
17
17
18
18
export default createTestingLibraryRule < Options , MessageIds > ( {
19
19
name : RULE_NAME ,
@@ -38,14 +38,17 @@ export default createTestingLibraryRule<Options, MessageIds>({
38
38
properties : {
39
39
utilNames : {
40
40
type : 'array' ,
41
- items : { type : 'string' } ,
41
+ items : {
42
+ type : 'string' ,
43
+ enum : [ 'debug' , 'logTestingPlaygroundURL' ] ,
44
+ } ,
42
45
} ,
43
46
} ,
44
47
additionalProperties : false ,
45
48
} ,
46
49
] ,
47
50
} ,
48
- defaultOptions : [ { utilNames : [ 'debug' ] } ] ,
51
+ defaultOptions : [ { utilNames : [ 'debug' , 'logTestingPlaygroundURL' ] } ] ,
49
52
50
53
create ( context , [ { utilNames } ] , helpers ) {
51
54
const suspiciousDebugVariableNames : string [ ] = [ ] ;
@@ -95,7 +98,7 @@ export default createTestingLibraryRule<Options, MessageIds>({
95
98
if (
96
99
isProperty ( property ) &&
97
100
ASTUtils . isIdentifier ( property . key ) &&
98
- utilNames . includes ( property . key . name )
101
+ ( utilNames as string [ ] ) . includes ( property . key . name )
99
102
) {
100
103
const identifierNode = getDeepestIdentifierNode ( property . value ) ;
101
104
@@ -140,7 +143,7 @@ export default createTestingLibraryRule<Options, MessageIds>({
140
143
const isChainedReferenceDebug = suspiciousReferenceNodes . some (
141
144
( suspiciousReferenceIdentifier ) => {
142
145
return (
143
- utilNames . includes ( callExpressionIdentifier . name ) &&
146
+ ( utilNames as string [ ] ) . includes ( callExpressionIdentifier . name ) &&
144
147
suspiciousReferenceIdentifier . name === referenceIdentifier . name
145
148
) ;
146
149
}
0 commit comments