File tree Expand file tree Collapse file tree 3 files changed +19
-35
lines changed Expand file tree Collapse file tree 3 files changed +19
-35
lines changed Original file line number Diff line number Diff line change @@ -7,21 +7,15 @@ export function createTypedInputRule(options: RuleOptions) {
7
7
return ESLintUtils . RuleCreator . withoutDocs ( {
8
8
create ( context ) {
9
9
return {
10
- 'CallExpression[callee.property.name="prepare"][arguments.length=1]' (
11
- node : TSESTree . CallExpression ,
10
+ 'CallExpression[callee.type=MemberExpression][callee.property.name="prepare"][arguments.length=1]' (
11
+ node : Omit < TSESTree . CallExpression , "arguments" | "callee" > & {
12
+ arguments : [ TSESTree . CallExpression [ "arguments" ] [ 0 ] ] ;
13
+ callee : TSESTree . MemberExpression ;
14
+ } ,
12
15
) {
13
- if ( node . callee . type !== TSESTree . AST_NODE_TYPES . MemberExpression ) {
14
- return ;
15
- }
16
-
17
- const arg = node . arguments [ 0 ] ;
18
- if ( ! arg ) {
19
- return ;
20
- }
21
-
22
16
const val = ASTUtils . getStaticValue (
23
- arg ,
24
- context . sourceCode . getScope ( arg ) ,
17
+ node . arguments [ 0 ] ,
18
+ context . sourceCode . getScope ( node . arguments [ 0 ] ) ,
25
19
) ;
26
20
if ( typeof val ?. value !== "string" ) {
27
21
return ;
Original file line number Diff line number Diff line change @@ -13,21 +13,15 @@ export function createTypedResultRule(options: RuleOptions) {
13
13
return ESLintUtils . RuleCreator . withoutDocs ( {
14
14
create ( context ) {
15
15
return {
16
- 'CallExpression[callee.property.name="prepare"][arguments.length=1]' (
17
- node : TSESTree . CallExpression ,
16
+ 'CallExpression[callee.type=MemberExpression][callee.property.name="prepare"][arguments.length=1]' (
17
+ node : Omit < TSESTree . CallExpression , "arguments" | "callee" > & {
18
+ arguments : [ TSESTree . CallExpression [ "arguments" ] [ 0 ] ] ;
19
+ callee : TSESTree . MemberExpression ;
20
+ } ,
18
21
) {
19
- if ( node . callee . type !== TSESTree . AST_NODE_TYPES . MemberExpression ) {
20
- return ;
21
- }
22
-
23
- const arg = node . arguments [ 0 ] ;
24
- if ( ! arg ) {
25
- return ;
26
- }
27
-
28
22
const val = ASTUtils . getStaticValue (
29
- arg ,
30
- context . sourceCode . getScope ( arg ) ,
23
+ node . arguments [ 0 ] ,
24
+ context . sourceCode . getScope ( node . arguments [ 0 ] ) ,
31
25
) ;
32
26
if ( typeof val ?. value !== "string" ) {
33
27
return ;
Original file line number Diff line number Diff line change @@ -6,17 +6,13 @@ export function createValidQueryRule(options: RuleOptions) {
6
6
return ESLintUtils . RuleCreator . withoutDocs ( {
7
7
create ( context ) {
8
8
return {
9
- 'CallExpression[callee.property.name="prepare"][arguments.length=1]' (
10
- node : TSESTree . CallExpression ,
9
+ 'CallExpression[callee.type=MemberExpression][callee.property.name="prepare"][arguments.length=1]' (
10
+ node : Omit < TSESTree . CallExpression , "arguments" | "callee" > & {
11
+ arguments : [ TSESTree . CallExpression [ "arguments" ] [ 0 ] ] ;
12
+ callee : TSESTree . MemberExpression ;
13
+ } ,
11
14
) {
12
- if ( node . callee . type !== TSESTree . AST_NODE_TYPES . MemberExpression ) {
13
- return ;
14
- }
15
-
16
15
const arg = node . arguments [ 0 ] ;
17
- if ( ! arg ) {
18
- return ;
19
- }
20
16
21
17
const val = ASTUtils . getStaticValue (
22
18
arg ,
You can’t perform that action at this time.
0 commit comments