-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat(eslint-plugin): Make explicit-member-accessibility fixable #331
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
feat(eslint-plugin): Make explicit-member-accessibility fixable #331
Conversation
f225d74
to
4f07f32
Compare
I did |
Codecov Report
@@ Coverage Diff @@
## master #331 +/- ##
==========================================
+ Coverage 97.27% 97.27% +<.01%
==========================================
Files 67 67
Lines 2348 2350 +2
Branches 335 335
==========================================
+ Hits 2284 2286 +2
Misses 43 43
Partials 21 21
|
packages/eslint-plugin/src/rules/explicit-member-accessibility.ts
Outdated
Show resolved
Hide resolved
Is a fixer for this a good thing? IMO There are two points to this rule:
The fixer takes care of (1), but it makes it too easy to circumvent (2). I'm not sure if we should be providing fixers for things like this that can have a greater effect on how your code works. |
That's good point. I thought the same while writing tests for this and actually I have not good answer for it. |
I'd like to hear thoughts from @typescript-eslint/core-team in regards to the addition of a fixer here. If we do want a fixer here, maybe it'd be worth making it default to private (so that it can be fixed, but so that it doesn't default to the most open modifier)? Note There's also #322 which is touching this rule, which will make it possible to ban using It sucks that eslint doesn't have a mechanism for saying "let the user pick one of these fixers" 😢, as that'd be ideal here. |
Though I'm not a core member. I remember that I added the same autofix into the local installed |
@bradzacher @mysticatea @j-f1 I changed my thought. I added this since it was useful to migrate my code base with this fixer easily. But I think I should put safety first. I'm closing this. Thank you for your feedbacks and reviews! |
This PR adds the ability to fix errors from
explicit-member-accessibility
rule automatically by addingpublic
specifier explicitly in code.I also added more tests for the rule since I wanted to confirm that
public
must be put beforereadonly
as per TypeScript grammar.