1
- const { AST_NODE_TYPES , TSESTree , ESLintUtils } = require ( "@typescript-eslint/utils" ) ;
1
+ const { AST_NODE_TYPES , ESLintUtils } = require ( "@typescript-eslint/utils" ) ;
2
2
const { createRule } = require ( "./utils.cjs" ) ;
3
3
const ts = require ( "typescript" ) ;
4
4
5
+ /**
6
+ * @typedef {import("@typescript-eslint/utils").TSESTree.CallExpression | import("@typescript-eslint/utils").TSESTree.NewExpression } CallOrNewExpression
7
+ */
8
+
5
9
const unset = Symbol ( ) ;
6
10
/**
7
11
* @template T
@@ -42,7 +46,7 @@ module.exports = createRule({
42
46
43
47
/** @type {(name: string) => boolean } */
44
48
const isSetOrAssert = name => name . startsWith ( "set" ) || name . startsWith ( "assert" ) ;
45
- /** @type {(node: TSESTree.Node) => boolean } */
49
+ /** @type {(node: import("@typescript-eslint/utils"). TSESTree.Node) => boolean } */
46
50
const isTrivia = node => {
47
51
if ( node . type === AST_NODE_TYPES . Identifier ) {
48
52
return node . name === "undefined" ;
@@ -56,7 +60,7 @@ module.exports = createRule({
56
60
return false ;
57
61
} ;
58
62
59
- /** @type {(node: TSESTree.CallExpression | TSESTree.NewExpression ) => boolean } */
63
+ /** @type {(node: CallOrNewExpression ) => boolean } */
60
64
const shouldIgnoreCalledExpression = node => {
61
65
if ( node . callee && node . callee . type === AST_NODE_TYPES . MemberExpression ) {
62
66
const methodName = node . callee . property . type === AST_NODE_TYPES . Identifier
@@ -97,7 +101,7 @@ module.exports = createRule({
97
101
return false ;
98
102
} ;
99
103
100
- /** @type {(node: TSESTree.Node, i: number, getSignature: () => ts.Signature | undefined) => void } */
104
+ /** @type {(node: import("@typescript-eslint/utils"). TSESTree.Node, i: number, getSignature: () => ts.Signature | undefined) => void } */
101
105
const checkArg = ( node , i , getSignature ) => {
102
106
if ( ! isTrivia ( node ) ) {
103
107
return ;
@@ -119,7 +123,7 @@ module.exports = createRule({
119
123
} ) ;
120
124
121
125
const comments = sourceCode . getCommentsBefore ( node ) ;
122
- /** @type {TSESTree.Comment | undefined } */
126
+ /** @type {import("@typescript-eslint/utils"). TSESTree.Comment | undefined } */
123
127
const comment = comments [ comments . length - 1 ] ;
124
128
125
129
if ( ! comment || comment . type !== "Block" ) {
@@ -170,7 +174,7 @@ module.exports = createRule({
170
174
}
171
175
} ;
172
176
173
- /** @type {(node: TSESTree.CallExpression | TSESTree.NewExpression ) => void } */
177
+ /** @type {(node: CallOrNewExpression ) => void } */
174
178
const checkArgumentTrivia = node => {
175
179
if ( shouldIgnoreCalledExpression ( node ) ) {
176
180
return ;
0 commit comments