Skip to content

Commit

Permalink
Merge pull request #47 from blond/issue-34
Browse files Browse the repository at this point in the history
Add `class-methods-use-this` rule
  • Loading branch information
blond committed Apr 22, 2017
2 parents 926a611 + df6c7ed commit 9ae4a9b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 11 additions & 0 deletions examples/bad/es6.js
Expand Up @@ -37,3 +37,14 @@ var foo = new Symbol('foo'); // The Symbol constructor is not intended to be use
function* foo() {
return 10; // This generator functions that do not have the `yield` keyword.
}

/*eslint class-methods-use-this: "error"*/
class A {
constructor() {
this.a = "hi";
}

sayHi() {
console.log("hi"); // The sayHi method doesn’t use this, so we can make it a static method.
}
}
3 changes: 2 additions & 1 deletion lib/es6-rules.js
Expand Up @@ -10,5 +10,6 @@ module.exports = {
'no-class-assign': 'error',
'no-const-assign': 'error',
'no-new-symbol': 'error',
'require-yield': 'error'
'require-yield': 'error',
'class-methods-use-this': 'error'
};

0 comments on commit 9ae4a9b

Please sign in to comment.