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

Bug: [prefer-readonly] autofixer doesn't add type to property that is mutated in the constructor #1056

Closed
Labels
accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workinglocked 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
@JounQin

Description

@JounQin

Repro

{"rules": {"@typescript-eslint/prefer-readonly":2  }}
// your repro code caseclassX{private_isValid?=true;getisValid():boolean{returnthis._isValid;}constructor(data?:{}){if(!data){this._isValid=false;}}}

Expected Result

No report

Actual Result

@typescript-eslint/prefer-readonlyMember'_isValid' is never reassigned; mark it as`readonly`

Versions

packageversion
@typescript-eslint/eslint-plugin2.3.3
@typescript-eslint/parser2.3.3
TypeScript3.6.3
ESLint6.5.1
node12.11.1
yarn1.19.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workinglocked 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

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp