@@ -76,9 +76,10 @@ export default util.createRule<Options, MessageIds>({
7676 | TSESTree . ArrowFunctionExpression
7777 | TSESTree . FunctionDeclaration
7878 | TSESTree . FunctionExpression
79- | TSESTree . TSAbstractMethodDefinition ,
79+ | TSESTree . TSEmptyBodyFunctionExpression
80+ | TSESTree . TSDeclareFunction ,
8081 ) : boolean {
81- if ( 'id' in node && node . id != null ) {
82+ if ( node . id != null ) {
8283 return true ;
8384 }
8485
@@ -102,7 +103,8 @@ export default util.createRule<Options, MessageIds>({
102103 | TSESTree . ArrowFunctionExpression
103104 | TSESTree . FunctionDeclaration
104105 | TSESTree . FunctionExpression
105- | TSESTree . TSAbstractMethodDefinition ,
106+ | TSESTree . TSEmptyBodyFunctionExpression
107+ | TSESTree . TSDeclareFunction ,
106108 ) : FuncOption {
107109 if ( node . type === AST_NODE_TYPES . ArrowFunctionExpression ) {
108110 // Always ignore non-async functions and arrow functions without parens, e.g. async foo => bar
@@ -116,7 +118,7 @@ export default util.createRule<Options, MessageIds>({
116118 return overrideConfig . named ?? baseConfig ;
117119
118120 // `generator-star-spacing` should warn anonymous generators. E.g. `function* () {}`
119- } else if ( ! ( 'generator' in node ) || node . generator === false ) {
121+ } else if ( ! node . generator ) {
120122 return overrideConfig . anonymous ?? baseConfig ;
121123 }
122124
@@ -133,7 +135,8 @@ export default util.createRule<Options, MessageIds>({
133135 | TSESTree . ArrowFunctionExpression
134136 | TSESTree . FunctionDeclaration
135137 | TSESTree . FunctionExpression
136- | TSESTree . TSAbstractMethodDefinition ,
138+ | TSESTree . TSEmptyBodyFunctionExpression
139+ | TSESTree . TSDeclareFunction ,
137140 ) : void {
138141 const functionConfig = getConfigForFunction ( node ) ;
139142
@@ -165,7 +168,7 @@ export default util.createRule<Options, MessageIds>({
165168 } else if (
166169 ! hasSpacing &&
167170 functionConfig === 'always' &&
168- ( ! node . typeParameters || ( 'id' in node && node != null ) )
171+ ( ! node . typeParameters || node . id )
169172 ) {
170173 context . report ( {
171174 node,
@@ -180,7 +183,8 @@ export default util.createRule<Options, MessageIds>({
180183 ArrowFunctionExpression : checkFunction ,
181184 FunctionDeclaration : checkFunction ,
182185 FunctionExpression : checkFunction ,
183- TSAbstractMethodDefinition : checkFunction ,
186+ TSEmptyBodyFunctionExpression : checkFunction ,
187+ TSDeclareFunction : checkFunction ,
184188 } ;
185189 } ,
186190} ) ;
0 commit comments