quick-lint-js

Find bugs in JavaScript programs.

E0231: methods cannot be readonly

Class and interface methods cannot be marked as read-only. It is a syntax error to write readonly on a method:

class SecureFetcher {
  readonly fetch() {
    // ...
  }
}

// TypeScript only:
interface Hasher {
  readonly mix(data: string): void;
}

To fix this error, remove the readonly keyword:

class SecureFetcher {
  fetch() {
    // ...
  }
}

Alternatively, for TypeScript interface methods, convert the method into a field with a function type:

interface Hasher {
  readonly mix: (data: string) => void;
}

Introduced in quick-lint-js version 2.6.0.

Documentation for other errors