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');
  }
}

Introduced in quick-lint-js version 0.2.0.

Documentation for other errors