quick-lint-js

Find bugs in JavaScript programs.

E0072: methods should not use the 'function' keyword

Classes and object literals can contain methods. It is an error to use the function keyword in a class or object literal when defining a method:

class Doge {
  function speak() {
    console.log('many woofie');
  }
}

To fix this error, remove the function keyword:

class Doge {
  speak() {
    console.log('many woofie');
  }
}

Documentation for other errors