class-methods-use-this
UnreleasedConfiguration
rslint.config.ts
Rule Details
This rule requires class instance methods to use this or super. Methods
that do not depend on an instance can often be ordinary functions or static
methods instead.
Examples of incorrect code for this rule:
Examples of correct code for this rule:
Options
exceptMethods
Use exceptMethods to exempt methods whose instance shape is required by an
external API.
enforceForClassFields
enforceForClassFields defaults to true. Set it to false to ignore arrow
functions and function expressions used as instance field initializers.
ignoreOverrideMethods
Use ignoreOverrideMethods to ignore TypeScript members marked with
override.
ignoreClassesWithImplements
Use "all" to ignore every member of a TypeScript class with an implements
clause, or "public-fields" to ignore only its public members.