Disable next line should disable the next effective line
See original GitHub issueWhat rule do you want to change?
eslint-disable-next-line
Does this change cause the rule to produce more or fewer warnings?
Unchanged
How will the change be implemented? (New option, new default behavior, etc.)?
New default behavior
Please provide some example code that this change will affect:
const DEFAULT = {
// eslint-disable-next-line id-length
MAX_MSG_PER_TEST: 100,
SAMPLE_MS: 500
};
What does the rule currently do for this code?
Disable the literal next line. With an id-length of 5 <= length <= 12, MAX_MSG_PER_TEST is invalid.
What will the rule do after it’s changed?
Disable the next line of code. With an id-length of 5 <= length <= 12, MAX_MSG_PER_TEST is valid.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Turning off eslint rule for a specific line - Stack Overflow
To disable next line: // eslint-disable-next-line no-use-before-define var thing = new Thing();. Or use the single line syntax:
Read more >How to disable ESLint rule for whole project using ts-standard?
In its settings "Engine" is set to "ts-standard". To disable a certain ESLint rule for one line I could write /* eslint-disable-next-line padded ......
Read more >ESLint Warnings Are an Anti-Pattern - DEV Community
A warn is simply an acknowledgement of a code style that may be dubious but should be allowed if the circumstance merits it....
Read more >Can I disable continuation of comments to the next line in Vim?
In Vim, if I'm typing a comment in a code file, and I hit Enter , it automatically makes the newline a comment,...
Read more >How to Ignore and Disable TypeScript Rules
The combined linter is a good idea because both TSLint and ESLint are ... Here is the different syntax for disabling next line...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
First of all, thanks for contributing! I’m 👎 to this proposal. While I understand the desire to pad comments with blank newlines for readability’s sake, this feels like it would add a lot of complexity (both in behavior and maintainability) to what is currently a very predictable and straightforward behavior. This would also be a breaking change.
If you’re worried about the comment being directly above it, have you considered using
eslint-disable-line
line comments at the end of the line in question?Given the above two comments, Ii sounds like making this change would require for rules to have some kind of metadata declaring whether they involve whitespace or not, so that ESLint can know if the whitespace around
eslint-disable-next-line
comments can safely be ignored. This would also require that all plugins with custom rules specify this metadata.Between it being a breaking change (and one that would potentially require all plugin authors to update their plugins), the increase in complexity of the implementation and maintainability (with less-straightforward behavior), and that there are already two other ways to solve this (that seem to stick to the style you’re discussing here, though please correct me if I’m wrong!), I’m not currently convinced this should be included in core.
A new kind of
eslint-disable-*
comment would alleviate some of my concerns, but I think I would need to be convinced of the value of introducing more options when we already have a number of ways to solve this in our current API.Some related issues:
That’s understandable. I put my hacker pants on and found I could simply edit ./lib/util/apply-disable-directives.js
from
to
vscode-eslint simply followed with the new logic as well. Which honestly was a fear that deterred me from jumping into the rabbit hole of fixing it myself first thing. I’m glad it was a simple fix.
I’ll also look into language agnostic linting tools to see if I can integrate them into any custom solutions here.
Thanks!