Formatting rule for disable directive spacing
See original GitHub issuePlease describe what the rule should do:
warn about (and ideally fix) spacing in eslint-disable and eslint-enable comments.
What category of rule is this? (place an “X” next to just one item)
[ ] Warns about a potential error (problem) [X] Suggests an alternate way of doing something (suggestion) [ ] Other (please specify:)
Provide 2-3 code examples that this rule will warn about:
Bad:
/* eslint-disable some-rule */
/* eslint-enable some-rule */
/* eslint-disable some-rule, other-rule */
// eslint-disable-next-line some-rule, other-rule
// eslint-disable-line some-rule , other-rule
Good:
/* eslint-disable some-rule */
/* eslint-enable some-rule */
/* eslint-disable some-rule, other-rule */
// eslint-disable-next-line some-rule, other-rule */
// eslint-disable-line some-rule, other-rule */
Why should this rule be included in ESLint (instead of a plugin)?
#14617 introduces fixable disable directives, which have the potential to be formatted with awkward spacing, so @mdjermanovic recommended opening this new issue
Are you willing to submit a pull request to implement this rule?
Potentially
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Code style formatting rule IDE0055 - .NET - Microsoft Learn
Learn about using code-style rule IDE0055 to format indentations, spaces, and new lines.
Read more >Formatting - Coding Style - Read the Docs
Use only spaces, and indent 4 spaces at a time. Do not use tabs in your code. ... Use tabs when it is...
Read more >Block ktlint-disable directive not working · Issue #967 - GitHub
The indent-rule is one of the most complex rules in ktlint. A first step would be to split this rule into separate rules...
Read more >Code Style & Formatting - Features | ReSharper - JetBrains
Namespace import style. To make your code more readable, you can remove redundant using directives and/or shorten qualified references in your C# and...
Read more >Clang-Format Style Options — Clang 16.0.0git documentation
DisableFormat : true --- Language: CSharp # Use 100 columns for C#. ColumnLimit: 100 ... An easy way to get a valid .clang-format...
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
I’m closing this issue since it isn’t likely that the proposed rule will be accepted.
Fix for https://github.com/eslint/eslint/pull/14617#issuecomment-892105159 is included in the recent ESLint v8.0.0-rc.0 release.
@TSMMark thanks for testing new features on your codebase! Please let us know if you encounter any issues with the new version of this autofix.
@TSMMark thanks for opening the issue! I don’t think we should add a core rule for this (plugin is a good idea though). My comment https://github.com/eslint/eslint/pull/14617#issuecomment-892192785 was about updating the autofix we implemented in https://github.com/eslint/eslint/pull/14617 to better handle the leading space if it doesn’t end up being too complex.