question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Formatting rule for disable directive spacing

See original GitHub issue

Please 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:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
mdjermanoviccommented, Sep 28, 2021

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.

2reactions
mdjermanoviccommented, Aug 9, 2021

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found