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
--report-unused-disable-directives should be autofixable #11815
Comments
Unfortunately, it looks like there wasn't enough interest from the team Thanks for contributing to ESLint and we appreciate your understanding. |
Apologies for letting this slip through the cracks. Personally, I'm not sure this should be fixable for the same reason that rules like That's just my opinion, though-- if other team members disagree and think this is worth implementing, I will defer to consensus. |
@platinumazure can you kindly help me understand how a user could be unaware they mistyped something? If the user mistyped a disable comment and it never worked, I think removing it is desirable, because either:
I suppose I'm assuming eslint users have builds fail when errors are reported. Is it common to use eslint differently? |
@dmnd Thanks for your reply. To be honest, I hadn't thought into it very deeply and your reasoning makes sense. I think I could imagine myself being annoyed if I had my disable comment get nuked and I had to type it out again, just because of a typo, but I agree the impact is no worse than that. |
@platinumazure also thanks to you for engaging in this issue ❤️ do you think eslint would be receptive to this idea? should the issue be opened again? |
Looks like @mysticatea had left a 👍 on the issue. @mysticatea, would you like to reopen and champion this issue? |
Thank you for the ping. Yes, I will champion. In most cases, people write |
@mysticatea Should we make an RFC for this? |
I'm interested tackling this issue & writing that RFC but I'm still a little shaky on the governance process here. Is this ready for me to send a PR to https://github.com/eslint/rfcs? |
seems a reasonable enhancement, I'll support it! not sure an RFC is required - it's just a non-breaking enhancement. // cc @mdjermanovic |
Is anyone still interested in this? It’s been open for over a year without any movement. Unless someone feels very strongly, we should close this as it was never accepted by the team. |
FWIW I'd be very interested in tackling it soon, if the team wills it. |
TSC Summary: This proposal proposes to make the TSC Question: Shall we accept this proposal? Is a RFC required? |
The team agreed that we'd like a way to autofix unused disable directives! Now we need an RFC to figure out how it should be implemented. So far we only autofix rules, so this will be a completely new type of autofixing. We're not sure that including this autofix in @JoshuaKGoldberg thanks for your continued interest in working on this feature! As you're starting on the RFC, feel free to discuss anything or ask for early feedback on ideas in this issue, then we can move discussion to the RFC PR once you've opened one with a concrete proposal. |
* New: Fixable disable directives * Part of the way there: not ready yet * Generally fixed up, and just started on unit tests * lodash.flatMap * Merge branch 'master' * Progress... * Fixed the remaining pre-existing unit tests * Fixed up some tests * unprocessedDirective.parentComment * Avoided rescan by passing commentToken in parentComment * A lil edge case * Fix directive grouping the other direction * Incorrect state directive reference * Simplified parentComment / commentToken range * Use Map in lib/linter/apply-disable-directives.js Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com> * Used suggestion for individual directives removal * Boolean in lib/cli-engine/cli-engine.js Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com> * Docs fixups * Added tests * Tests and fix for multiple rule lists * Remove unused sourceCode from tests * Added high-level test in linter.js * Apply suggestions from code review Co-authored-by: Brandon Mills <btmills@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com> * Added require * Wrong order... * Also mention in command-line-interface.md * Respect disableFixes (not yet tested) * Fixed up existing tests * Add unit test for options.disableFixes * Apply suggestions from code review Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com> Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com> Co-authored-by: Brandon Mills <btmills@users.noreply.github.com>
The version of ESLint you are using.
v5.16.0
The problem you want to solve.
I want to enable
--report-unused-disable-directives
on a large existing codebase, but it surfaces too many problems to be practical to fix manually. So I'd need to write a script. At that point, why not make the directive autofixable?Your take on the correct solution to problem.
Run
eslint --fix --report-unused-disable-directives
Are you willing to submit a pull request to implement this change?
Yes
The text was updated successfully, but these errors were encountered: