eslint-plugin-misc

ESLint plugin

This project is maintained by iliubinskii

typescript/prefer-class-method

ESLint plugin / typescript/prefer-class-method

Requires use of class methods instead of function properties.

module.exports = {
  plugins: ["misc"],
  rules: {
    "misc/typescript/prefer-class-method": "error"
  }
};

Examples of incorrect code

class SampleClass {
  static f = () => {};
  g = () => {};
}

Examples of correct code

class SampleClass1 {
  static f: F = () => {};
  g: G = () => {};
}

class SampleClass2 {
  static f() {}
  g() {}
}