1
- import type * as ESTree from "estree "
1
+ import type { TSESTree } from "@typescript-eslint/types "
2
2
import { createRule } from "../utils"
3
3
import type { RuleContext } from "../types"
4
4
import { extractStoreReferences } from "./reference-helpers/svelte-store"
@@ -21,18 +21,18 @@ export default createRule("derived-has-same-inputs-outputs", {
21
21
create ( context ) {
22
22
/** check node type */
23
23
function isIdentifierOrArrayExpression (
24
- node : ESTree . SpreadElement | ESTree . Expression ,
25
- ) : node is ESTree . Identifier | ESTree . ArrayExpression {
24
+ node : TSESTree . SpreadElement | TSESTree . Expression ,
25
+ ) : node is TSESTree . Identifier | TSESTree . ArrayExpression {
26
26
return [ "Identifier" , "ArrayExpression" ] . includes ( node . type )
27
27
}
28
28
29
29
type ArrowFunctionExpressionOrFunctionExpression =
30
- | ESTree . ArrowFunctionExpression
31
- | ESTree . FunctionExpression
30
+ | TSESTree . ArrowFunctionExpression
31
+ | TSESTree . FunctionExpression
32
32
33
33
/** check node type */
34
34
function isFunctionExpression (
35
- node : ESTree . SpreadElement | ESTree . Expression ,
35
+ node : TSESTree . SpreadElement | TSESTree . Expression ,
36
36
) : node is ArrowFunctionExpressionOrFunctionExpression {
37
37
return [ "ArrowFunctionExpression" , "FunctionExpression" ] . includes (
38
38
node . type ,
@@ -45,7 +45,7 @@ export default createRule("derived-has-same-inputs-outputs", {
45
45
*/
46
46
function checkIdentifier (
47
47
context : RuleContext ,
48
- args : ESTree . Identifier ,
48
+ args : TSESTree . Identifier ,
49
49
fn : ArrowFunctionExpressionOrFunctionExpression ,
50
50
) {
51
51
const fnParam = fn . params [ 0 ]
@@ -54,7 +54,7 @@ export default createRule("derived-has-same-inputs-outputs", {
54
54
if ( expectedName !== fnParam . name ) {
55
55
context . report ( {
56
56
node : fn ,
57
- loc : fnParam . loc ! ,
57
+ loc : fnParam . loc ,
58
58
messageId : "unexpected" ,
59
59
data : { name : expectedName } ,
60
60
} )
@@ -67,7 +67,7 @@ export default createRule("derived-has-same-inputs-outputs", {
67
67
*/
68
68
function checkArrayExpression (
69
69
context : RuleContext ,
70
- args : ESTree . ArrayExpression ,
70
+ args : TSESTree . ArrayExpression ,
71
71
fn : ArrowFunctionExpressionOrFunctionExpression ,
72
72
) {
73
73
const fnParam = fn . params [ 0 ]
@@ -82,7 +82,7 @@ export default createRule("derived-has-same-inputs-outputs", {
82
82
if ( expectedName !== element . name ) {
83
83
context . report ( {
84
84
node : fn ,
85
- loc : element . loc ! ,
85
+ loc : element . loc ,
86
86
messageId : "unexpected" ,
87
87
data : { name : expectedName } ,
88
88
} )
0 commit comments