File tree Expand file tree Collapse file tree 3 files changed +12
-13
lines changed
packages/eslint-plugin/src/rules Expand file tree Collapse file tree 3 files changed +12
-13
lines changed Original file line number Diff line number Diff line change @@ -206,6 +206,7 @@ export default tseslint.config(
206
206
'error' ,
207
207
{ commentPattern : '.*intentional fallthrough.*' } ,
208
208
] ,
209
+ 'no-unreachable-loop' : 'error' ,
209
210
'one-var' : [ 'error' , 'never' ] ,
210
211
211
212
//
Original file line number Diff line number Diff line change @@ -170,18 +170,15 @@ export default createRule({
170
170
. getSymbolAtLocation ( tsNode ) !
171
171
. getDeclarations ( ) ! ;
172
172
173
- for ( const declaration of declarations ) {
174
- for ( const member of ( declaration as ts . EnumDeclaration ) . members ) {
175
- return member . initializer
176
- ? tsutils . isTypeFlagSet (
177
- typeChecker . getTypeAtLocation ( member . initializer ) ,
178
- ts . TypeFlags . StringLike ,
179
- )
180
- ? AllowedType . String
181
- : AllowedType . Number
182
- : AllowedType . Number ;
183
- }
184
- }
173
+ const [ { initializer } ] = ( declarations [ 0 ] as ts . EnumDeclaration )
174
+ . members ;
175
+ return initializer &&
176
+ tsutils . isTypeFlagSet (
177
+ typeChecker . getTypeAtLocation ( initializer ) ,
178
+ ts . TypeFlags . StringLike ,
179
+ )
180
+ ? AllowedType . String
181
+ : AllowedType . Number ;
185
182
}
186
183
187
184
// Finally, we default to the type of the first enum member
Original file line number Diff line number Diff line change @@ -166,7 +166,8 @@ export default createRule({
166
166
} ) ;
167
167
}
168
168
169
- for ( const signature of functionType . getCallSignatures ( ) ) {
169
+ const signature = functionType . getCallSignatures ( ) . at ( 0 ) ;
170
+ if ( signature ) {
170
171
const functionReturnType = signature . getReturnType ( ) ;
171
172
const result = isUnsafeAssignment (
172
173
returnNodeType ,
You can’t perform that action at this time.
0 commit comments