-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed as not planned
Labels
enhancement: new base rule extensionNew base rule extension required to handle a TS specific caseNew base rule extension required to handle a TS specific casefix: user errorissue was fixed by correcting the configuration / correcting the codeissue was fixed by correcting the configuration / correcting the codelocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.package: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin
Description
Before You File a Proposal Please Confirm You Have Done The Following...
- I have searched for related issues and found none that match my proposal.
- I have searched the current extension rule list and found no rules that match my proposal.
- I have read the FAQ and my problem is not listed.
My proposal is suitable for this project
- My proposal specifically checks TypeScript syntax, or it proposes a check that requires type information to be accurate.
- I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).
Link to the base rule
https://eslint.org/docs/latest/rules/accessor-pairs
Description
It's possible to define a setter without a getter, and have everything type check successfully as if the getter exists.
The code in this playground errors at runtime but still type checks to due an apparent soundness issue with the type system.
The eslint/accessor-pairs rule appears to address this but it doesn't work for typescript-eslint
Fail
class MyClass {
private _myProp: boolean = false;
set myProp(value: boolean) {
this._myProp = value;
}
}Pass
class MyClass {
private _myProp: boolean = false;
get myProp(): boolean {
return this._myProp;
}
set myProp(value: boolean) {
this._myProp = value;
}
}Additional Info
No response
kirkwaiblinger
Metadata
Metadata
Assignees
Labels
enhancement: new base rule extensionNew base rule extension required to handle a TS specific caseNew base rule extension required to handle a TS specific casefix: user errorissue was fixed by correcting the configuration / correcting the codeissue was fixed by correcting the configuration / correcting the codelocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.package: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin