Skip to content

[explicit-member-accessibility] "explicit" option suggestions #4647

@alumni

Description

@alumni
  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have read the FAQ and my problem is not listed.

Repro

{
  "rules": {
    "@typescript-eslint/explicit-member-accessibility": "error"
  }
}
export class Dog {
    bark() {
        console.log('woof!');
    }
}

Expected Result

The method bark() is missing the accessibility modified. eslint --fix should add public.

Actual Result

The method bark() is missing the accessibility modified. eslint --fix cannot automatically fix this.

Additional Info

The docs https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md#attributes mention this rule is fixable. This only works for { accessibility: 'no-public' } but not for { accessibility: 'explicit' } (which is the default).

Versions

package version
@typescript-eslint/eslint-plugin 5.14.0
@typescript-eslint/parser 5.14.0
TypeScript 4.6.2
ESLint 8.10.0
node 16.14.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuepackage: 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