Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore constructors in @typescript-eslint/explicit-member-accessibility #100

Closed
mure opened this issue Jul 27, 2022 · 1 comment · Fixed by #158
Closed

Ignore constructors in @typescript-eslint/explicit-member-accessibility #100

mure opened this issue Jul 27, 2022 · 1 comment · Fixed by #158
Assignees

Comments

@mure
Copy link
Collaborator

mure commented Jul 27, 2022

@typescript-eslint/explicit-member-accessibility by default is forcing us to add public before every constructor, even though 99.9% of the time the implicit public is expected.
We could set [ { overrides: { constructors: 'no-public' } } ] to change this: https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md#disallow-the-use-of-public-on-a-given-member

@jattasNI
Copy link
Collaborator

jattasNI commented Sep 8, 2022

We agreed not to require public on constructors. We decided to prefer turning off enforcement (to avoid churn) rather than enforcing that there should be no modifier.

@rajsite to own turning this decision into a config change.

@jattasNI jattasNI self-assigned this Sep 19, 2024
rajsite pushed a commit that referenced this issue Sep 26, 2024
# Rationale

Resolves #100. Constructors may now be marked `public`, `private`, or
have no accessibility modifier. Previously they had to be marked
`public` or `private`.

# Implementation

Set `overrides: { constructors: 'off' }` in the TS rule configuration.

# Testing

Added a constructor to the TypeScript test and verified the rule
previously errored if it didn't have a modifier but now allows this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants