eslint-plugin-misc

ESLint plugin

This project is maintained by iliubinskii

typescript/prefer-readonly-property

ESLint plugin / typescript/prefer-readonly-property

Disallows writable properties.

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

Examples of incorrect code

class C {
  x: string;
}

Examples of correct code

class C {
  readonly x: string;
}