Skip to content

Commit

Permalink
docs(es6): add example for class-methods-use-this rule
Browse files Browse the repository at this point in the history
  • Loading branch information
blond committed Apr 22, 2017
1 parent 27e25f7 commit df6c7ed
Showing 1 changed file with 11 additions and 0 deletions.
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.
}
}

0 comments on commit df6c7ed

Please sign in to comment.