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) {
77 return ESLintUtils . RuleCreator . withoutDocs ( {
88 create ( context ) {
99 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+ } ,
1215 ) {
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-
2216 const val = ASTUtils . getStaticValue (
23- arg ,
24- context . sourceCode . getScope ( arg ) ,
17+ node . arguments [ 0 ] ,
18+ context . sourceCode . getScope ( node . arguments [ 0 ] ) ,
2519 ) ;
2620 if ( typeof val ?. value !== "string" ) {
2721 return ;
Original file line number Diff line number Diff line change @@ -13,21 +13,15 @@ export function createTypedResultRule(options: RuleOptions) {
1313 return ESLintUtils . RuleCreator . withoutDocs ( {
1414 create ( context ) {
1515 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+ } ,
1821 ) {
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-
2822 const val = ASTUtils . getStaticValue (
29- arg ,
30- context . sourceCode . getScope ( arg ) ,
23+ node . arguments [ 0 ] ,
24+ context . sourceCode . getScope ( node . arguments [ 0 ] ) ,
3125 ) ;
3226 if ( typeof val ?. value !== "string" ) {
3327 return ;
Original file line number Diff line number Diff line change @@ -6,17 +6,13 @@ export function createValidQueryRule(options: RuleOptions) {
66 return ESLintUtils . RuleCreator . withoutDocs ( {
77 create ( context ) {
88 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+ } ,
1114 ) {
12- if ( node . callee . type !== TSESTree . AST_NODE_TYPES . MemberExpression ) {
13- return ;
14- }
15-
1615 const arg = node . arguments [ 0 ] ;
17- if ( ! arg ) {
18- return ;
19- }
2016
2117 const val = ASTUtils . getStaticValue (
2218 arg ,
You can’t perform that action at this time.
0 commit comments