Skip to content

Commit

Permalink
Merge pull request #1644 from mightyiam/class-methods-use-this
Browse files Browse the repository at this point in the history
feat!: @typescript-eslint/class-methods-use-this
  • Loading branch information
mightyiam committed Jul 13, 2024
2 parents 915bdf0 + 55a6a8c commit 27f8f29
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
9 changes: 9 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ const rules = {
},
},
],
'@typescript-eslint/class-methods-use-this': [
'error',
{
exceptMethods: [],
enforceForClassFields: true,
ignoreOverrideMethods: false,
ignoreClassesThatImplementAnInterface: false,
},
],
'@typescript-eslint/class-literal-property-style': ['error', 'fields'],
'@typescript-eslint/consistent-generic-constructors': [
'error',
Expand Down
2 changes: 0 additions & 2 deletions src/test/_rules_to_consider.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export const rulesToConsider = [
'@typescript-eslint/class-methods-use-this',
'@typescript-eslint/consistent-return',
'@typescript-eslint/default-param-last',
'@typescript-eslint/explicit-member-accessibility',
Expand Down Expand Up @@ -70,7 +69,6 @@ export const rulesToConsider = [
'callback-return',
'camelcase',
'capitalized-comments',
'class-methods-use-this',
'complexity',
'consistent-return',
'consistent-this',
Expand Down
10 changes: 10 additions & 0 deletions src/test/_util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export const expectedExportedValue: TSESLint.FlatConfig.Config = {
checkForEach: false,
},
],
'class-methods-use-this': ['off'],
'constructor-super': ['error'],
curly: ['error', 'multi-line'],
'default-case-last': ['error'],
Expand Down Expand Up @@ -294,6 +295,15 @@ export const expectedExportedValue: TSESLint.FlatConfig.Config = {
},
},
],
'@typescript-eslint/class-methods-use-this': [
'error',
{
exceptMethods: [],
enforceForClassFields: true,
ignoreOverrideMethods: false,
ignoreClassesThatImplementAnInterface: false,
},
],
'@typescript-eslint/class-literal-property-style': ['error', 'fields'],
'@typescript-eslint/consistent-generic-constructors': [
'error',
Expand Down

0 comments on commit 27f8f29

Please sign in to comment.