@@ -75,16 +75,18 @@ export default util.createRule<Options, MessageIds>({
75
75
node :
76
76
| TSESTree . ArrowFunctionExpression
77
77
| TSESTree . FunctionDeclaration
78
- | TSESTree . FunctionExpression ,
78
+ | TSESTree . FunctionExpression
79
+ | TSESTree . TSAbstractMethodDefinition ,
79
80
) : boolean {
80
- if ( node . id ) {
81
+ if ( 'id' in node && node . id != null ) {
81
82
return true ;
82
83
}
83
84
84
85
const parent = node . parent ! ;
85
86
86
87
return (
87
88
parent . type === AST_NODE_TYPES . MethodDefinition ||
89
+ parent . type === AST_NODE_TYPES . TSAbstractMethodDefinition ||
88
90
( parent . type === AST_NODE_TYPES . Property &&
89
91
( parent . kind === 'get' || parent . kind === 'set' || parent . method ) )
90
92
) ;
@@ -99,7 +101,8 @@ export default util.createRule<Options, MessageIds>({
99
101
node :
100
102
| TSESTree . ArrowFunctionExpression
101
103
| TSESTree . FunctionDeclaration
102
- | TSESTree . FunctionExpression ,
104
+ | TSESTree . FunctionExpression
105
+ | TSESTree . TSAbstractMethodDefinition ,
103
106
) : FuncOption {
104
107
if ( node . type === AST_NODE_TYPES . ArrowFunctionExpression ) {
105
108
// Always ignore non-async functions and arrow functions without parens, e.g. async foo => bar
@@ -113,7 +116,7 @@ export default util.createRule<Options, MessageIds>({
113
116
return overrideConfig . named ?? baseConfig ;
114
117
115
118
// `generator-star-spacing` should warn anonymous generators. E.g. `function* () {}`
116
- } else if ( ! node . generator ) {
119
+ } else if ( ! ( 'generator' in node ) || node . generator === false ) {
117
120
return overrideConfig . anonymous ?? baseConfig ;
118
121
}
119
122
@@ -129,7 +132,8 @@ export default util.createRule<Options, MessageIds>({
129
132
node :
130
133
| TSESTree . ArrowFunctionExpression
131
134
| TSESTree . FunctionDeclaration
132
- | TSESTree . FunctionExpression ,
135
+ | TSESTree . FunctionExpression
136
+ | TSESTree . TSAbstractMethodDefinition ,
133
137
) : void {
134
138
const functionConfig = getConfigForFunction ( node ) ;
135
139
@@ -161,7 +165,7 @@ export default util.createRule<Options, MessageIds>({
161
165
} else if (
162
166
! hasSpacing &&
163
167
functionConfig === 'always' &&
164
- ( ! node . typeParameters || node . id )
168
+ ( ! node . typeParameters || ( 'id' in node && node != null ) )
165
169
) {
166
170
context . report ( {
167
171
node,
@@ -176,6 +180,7 @@ export default util.createRule<Options, MessageIds>({
176
180
ArrowFunctionExpression : checkFunction ,
177
181
FunctionDeclaration : checkFunction ,
178
182
FunctionExpression : checkFunction ,
183
+ TSAbstractMethodDefinition : checkFunction ,
179
184
} ;
180
185
} ,
181
186
} ) ;
0 commit comments