-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
accepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issuebugSomething isn't workingSomething isn't workinghas prthere is a PR raised to close thisthere is a PR raised to close thispackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin
Description
Repro
Using the repo code from https://github.com/WGroenestein/typescript-eslint-prefer-readonly-class-mixin
- run "npm install"
- run "npm run build"
- see that the build compiles without errors
- run "npm run lint"
- see that it fails with error
file.ts
7:3 error Member '_name' is never reassigned; mark it as `readonly` @typescript-eslint/prefer-readonly
✖ 1 problem (1 error, 0 warnings)
1 error and 0 warnings potentially fixable with the `--fix` option.
- run "npm run fix-lint"
- see that it prefixed "_name" in "file.ts" with readonly
- run "npm run build"
- see that the build fails with error
file.ts(10,9): error TS2540: Cannot assign to '_name' because it is a read-only property.
Expected Result
Fields which are assigned outside the constructor (e.g. setters) in mixin classes are not marked as not assigned / readonly
Actual Result
They are reported as errors, and when running --fix it breaks the build
Additional Info
The debug log can be found in the repo (https://github.com/WGroenestein/typescript-eslint-prefer-readonly-class-mixin/blob/master/debug.log)
Versions
package | version |
---|---|
@typescript-eslint/eslint-plugin |
4.2.0 |
@typescript-eslint/parser |
4.2.0 |
TypeScript |
4.0.3 |
ESLint |
7.9.0 |
node |
12.18.3 |
Metadata
Metadata
Assignees
Labels
accepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issuebugSomething isn't workingSomething isn't workinghas prthere is a PR raised to close thisthere is a PR raised to close thispackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin