New rule: eslint-disable-next-line ...
See original GitHub issuePremise
With the // eslint-disable-line ...
comment, lines can get a bit long. It’d be nice to be able to put the comment on the preceding line.
When does this rule warn? Please describe and show example code:
For example:
// eslint-disable-line no-extend-native
Map.prototype.updateGrid = function updateGrid(col, row) {
return this.merge({ col, row });
};
Instead of:
Map.prototype.updateGrid = function updateGrid(col, row) { // eslint-disable-line no-extend-native
return this.merge({ col, row });
};
It’d be great if the parser was smart enough to recognize when the line is effectively blank, it’s referring to the next line. However, in case that’s unreasonable, let me propose a new rule: // eslint-disable-next-line ...
For example:
// eslint-disable-next-line no-extend-native
Map.prototype.updateGrid = function updateGrid(col, row) {
return this.merge({ col, row });
};
Is this rule preventing an error or is it stylistic?
Stylistic.
Why is this rule a candidate for inclusion instead of creating a custom rule?
Not sure if it can be written as a stand-alone rule.
Are you willing to create the rule yourself?
No. I’m not sure this is in my skill set.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:11 (7 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: var thing = new Thing(); ......
Read more >Rules - ESLint - Pluggable JavaScript Linter
Rules are the core building block of ESLint. A rule validates if your code meets a certain expectation, and what to do if...
Read more >How to disable ESLint for some lines, files or folders
To turn off ESLint in the whole file, you can add /* eslint-disable */ in the first line of that file. Alternatively, you...
Read more >eslint-plugin-unicorn/no-abusive-eslint-disable.md at main
This rule makes you specify the rules you want to disable when using eslint-disable , eslint-disable-line or eslint-disable-next-line comments. If you want to ......
Read more >Ignore Lines and Files In ESLint - Mastering JS
The // eslint-disable-line comment disables the no-eval rule for just that line. You can also disable the no-eval rule for an entire function ......
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
@ilyavolodin I think the reason is
/*eslint-disable */
requires a matching/*eslint-enable */
afterwards and doing that only for a single line, just because the line gets too long with the// eslint-disable-line
directive is a bit wasteful. At least that’s how I feel and why I’d support something like this.@bionikspoon is that accurate?
For what it’s worth, I would support this too.