1- import type * as ESTree from "estree "
1+ import type { TSESTree } from "@typescript-eslint/types "
22import { createRule } from "../utils"
33import type { RuleContext } from "../types"
44import { extractStoreReferences } from "./reference-helpers/svelte-store"
@@ -21,18 +21,18 @@ export default createRule("derived-has-same-inputs-outputs", {
2121 create ( context ) {
2222 /** check node type */
2323 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 {
2626 return [ "Identifier" , "ArrayExpression" ] . includes ( node . type )
2727 }
2828
2929 type ArrowFunctionExpressionOrFunctionExpression =
30- | ESTree . ArrowFunctionExpression
31- | ESTree . FunctionExpression
30+ | TSESTree . ArrowFunctionExpression
31+ | TSESTree . FunctionExpression
3232
3333 /** check node type */
3434 function isFunctionExpression (
35- node : ESTree . SpreadElement | ESTree . Expression ,
35+ node : TSESTree . SpreadElement | TSESTree . Expression ,
3636 ) : node is ArrowFunctionExpressionOrFunctionExpression {
3737 return [ "ArrowFunctionExpression" , "FunctionExpression" ] . includes (
3838 node . type ,
@@ -45,7 +45,7 @@ export default createRule("derived-has-same-inputs-outputs", {
4545 */
4646 function checkIdentifier (
4747 context : RuleContext ,
48- args : ESTree . Identifier ,
48+ args : TSESTree . Identifier ,
4949 fn : ArrowFunctionExpressionOrFunctionExpression ,
5050 ) {
5151 const fnParam = fn . params [ 0 ]
@@ -54,7 +54,7 @@ export default createRule("derived-has-same-inputs-outputs", {
5454 if ( expectedName !== fnParam . name ) {
5555 context . report ( {
5656 node : fn ,
57- loc : fnParam . loc ! ,
57+ loc : fnParam . loc ,
5858 messageId : "unexpected" ,
5959 data : { name : expectedName } ,
6060 } )
@@ -67,7 +67,7 @@ export default createRule("derived-has-same-inputs-outputs", {
6767 */
6868 function checkArrayExpression (
6969 context : RuleContext ,
70- args : ESTree . ArrayExpression ,
70+ args : TSESTree . ArrayExpression ,
7171 fn : ArrowFunctionExpressionOrFunctionExpression ,
7272 ) {
7373 const fnParam = fn . params [ 0 ]
@@ -82,7 +82,7 @@ export default createRule("derived-has-same-inputs-outputs", {
8282 if ( expectedName !== element . name ) {
8383 context . report ( {
8484 node : fn ,
85- loc : element . loc ! ,
85+ loc : element . loc ,
8686 messageId : "unexpected" ,
8787 data : { name : expectedName } ,
8888 } )
0 commit comments