@@ -154,6 +154,27 @@ export class Guard {
154154 return this . containsToken ( 'Identifier' , 'arguments' , node ) ;
155155 }
156156
157+ hasThisParameter ( fn : AnyFunction ) : boolean {
158+ if ( fn . params . length === 0 ) {
159+ return false ;
160+ }
161+
162+ const [ firstParam ] = fn . params ;
163+
164+ if ( firstParam . type === AST_NODE_TYPES . Identifier ) {
165+ return firstParam . name === 'this' ;
166+ }
167+
168+ if (
169+ firstParam . type === AST_NODE_TYPES . TSParameterProperty &&
170+ firstParam . parameter . type === AST_NODE_TYPES . Identifier
171+ ) {
172+ return firstParam . parameter . name === 'this' ;
173+ }
174+
175+ return false ;
176+ }
177+
157178 containsTokenSequence ( sequence : [ string , string ] [ ] , node : TSESTree . Node ) : boolean {
158179 return this . sourceCode . getTokens ( node ) . some ( ( _ , tokenIndex , tokens ) => {
159180 return sequence . every ( ( [ expectedType , expectedValue ] , i ) => {
@@ -248,6 +269,7 @@ export class Guard {
248269 ! this . containsArguments ( fn ) &&
249270 ! this . containsNewDotTarget ( fn ) ;
250271 if ( ! isSafe ) return false ;
272+ if ( this . hasThisParameter ( fn ) ) return false ;
251273 if ( this . isIgnored ( fn ) ) return false ;
252274 if ( this . options . allowNamedFunctions === true && this . isNamedFunction ( fn ) ) return false ;
253275 if ( this . options . allowNamedFunctions === 'only-expressions' && this . isNamedFunctionExpression ( fn ) ) return false ;
0 commit comments