Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[naming-convention] Allow underscore prefix for backing fields #816

Closed as not planned
Labels
accepting prsGo ahead, send a pull request that resolves this issueenhancement: plugin rule optionNew rule option for an existing eslint-plugin rulelocked due to agePlease 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-plugin
@glen-84

Description

@glen-84

Edit: The description below referred to themember-naming rule, which has since been replaced by the newnaming-convention rule. This issue is still relevant.


Repro

{"rules": {"@typescript-eslint/member-naming": ["error", {"private":"^(?!_)" }]  }}
classExample{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.publicgetvar2(){returnthis._var2;}}

Expected Result

Error for_var1, but not for_var2 (because it's a backing field).

Actual Result

Error for both fields.

Additional Info

SimilarTSLint issue with 33 👍.

Since this rule is different to the one in TSLint, the implementation would be different. Maybe anignoreBackingFields: boolean option, or a way to set the naming for backing fields separately.

Versions

packageversion
@typescript-eslint/eslint-plugin1.13.0
@typescript-eslint/parser1.13.0
TypeScript3.4.5
ESLint6.1.0
node10.16.0
npm6.9.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issueenhancement: plugin rule optionNew rule option for an existing eslint-plugin rulelocked due to agePlease 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-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp