Closed as not planned
Description
Edit: The description below referred to the member-naming
rule, which has since been replaced by the new naming-convention
rule. This issue is still relevant.
Repro
{
"rules": {
"@typescript-eslint/member-naming": ["error", { "private": "^(?!_)" }]
}
}
class Example {
private _var1; // Not a backing field, shouldn't start with an underscore.
private _var2; // Allowed, as it's a backing field for the `var2` property.
public get var2() {
return this._var2;
}
}
Expected Result
Error for _var1
, but not for _var2
(because it's a backing field).
Actual Result
Error for both fields.
Additional Info
Similar TSLint issue with 33 👍.
Since this rule is different to the one in TSLint, the implementation would be different. Maybe an ignoreBackingFields: boolean
option, or a way to set the naming for backing fields separately.
Versions
package | version |
---|---|
@typescript-eslint/eslint-plugin |
1.13.0 |
@typescript-eslint/parser |
1.13.0 |
TypeScript |
3.4.5 |
ESLint |
6.1.0 |
node |
10.16.0 |
npm |
6.9.0 |