Skip to content

Commit

Permalink
feat: use TS variant of class-methods-use-this
Browse files Browse the repository at this point in the history
By default, this does not deviate in behavior from the original rule.
It does, however, provide users with additional configuration options
to disable errors when `this` is not used in classes that
implement interfaces or methods that explicitly override parent methods.

The configuration we provide has been left at the default, though,
since those rules are arguably over-permissive in the pursuit of not
requiring type information.

Closes iamturns#344.
  • Loading branch information
Kenneth-Sills committed Aug 5, 2024
1 parent 766a2b9 commit 3685578
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,16 @@ module.exports = {
'object-curly-spacing': 'off',
'@typescript-eslint/object-curly-spacing': baseStyleRules['object-curly-spacing'],

// The base rule works fine with Typescript, but the Typescript version has
// additional options for our users.
'class-methods-use-this': 'off',
'@typescript-eslint/class-methods-use-this': [
baseBestPracticesRules['class-methods-use-this'][0],
{
...baseBestPracticesRules['class-methods-use-this'][1],
},
],

// Append 'ts' and 'tsx' to Airbnb 'import/extensions' rule
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md
'import/extensions': [
Expand Down

0 comments on commit 3685578

Please sign in to comment.