1
- import { ESLintUtils , TSESTree } from '@typescript-eslint/experimental-utils' ;
2
- import { getDocsUrl , ALL_RETURNING_NODES } from '../utils' ;
1
+ import { TSESTree } from '@typescript-eslint/experimental-utils' ;
2
+ import { ALL_RETURNING_NODES } from '../utils' ;
3
3
import { isIdentifier } from '../node-utils' ;
4
- import detect from '../testing-library-detection ' ;
4
+ import { createTestingLibraryRule } from '../create- testing-library-rule ' ;
5
5
6
6
export const RULE_NAME = 'no-node-access' ;
7
7
export type MessageIds = 'noNodeAccess' ;
8
8
type Options = [ ] ;
9
9
10
- export default ESLintUtils . RuleCreator ( getDocsUrl ) < Options , MessageIds > ( {
10
+ export default createTestingLibraryRule < Options , MessageIds > ( {
11
11
name : RULE_NAME ,
12
12
meta : {
13
13
type : 'problem' ,
@@ -25,7 +25,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
25
25
} ,
26
26
defaultOptions : [ ] ,
27
27
28
- create : detect ( ( context : any , _ : any , helpers : any ) => {
28
+ create : ( context , _ , helpers ) => {
29
29
function showErrorForNodeAccess ( node : TSESTree . MemberExpression ) {
30
30
isIdentifier ( node . property ) &&
31
31
ALL_RETURNING_NODES . includes ( node . property . name ) &&
@@ -41,5 +41,5 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
41
41
[ 'ExpressionStatement MemberExpression' ] : showErrorForNodeAccess ,
42
42
[ 'VariableDeclarator MemberExpression' ] : showErrorForNodeAccess ,
43
43
} ;
44
- } ) ,
44
+ } ,
45
45
} ) ;
0 commit comments