`keyword-spacing` should disallow tabs (or have an option to do so)
See original GitHub issueESLint version: 3.19.0
Problem I want to solve: accidental tabs after var
and let
My proposal:
Currently the keyword-spacing
rule has two possible values for each sub-option: true
and false
. I propose adding a "space"
possibility here to specify that these keywords must have a space before or after them.
Current usage, requiring an whitespace before and after every keyword
{
"keyword-spacing": ["error", {
"before": true,
"after": true
}]
}
Proposed usage, requiring any whitespace before but only spaces after it
{
"keyword-spacing": ["error", {
"before": true,
"after": "space"
}]
}
Motivation: In a style with 4-character-wide tabs, the following two lines look identical
var thing = "stuff";
var/*tab*/thing = "stuff";
The proposed tertiary option for the keyword-spacing
rule would catch the second line above, preventing this common, though inconsequential, typo.
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (6 by maintainers)
Top Results From Across the Web
In keyword-spacing overrides option, we should be able to ...
So I want to be able to configure the keyword-spacing rule to disable one of the keyword check. Now that I think this...
Read more >keyword-spacing - ESLint - Pluggable JavaScript Linter
This rule enforces consistent spacing around keywords and keyword-like tokens: as (in module declarations), async (of async functions), await (of await ...
Read more >1.8 — Whitespace and basic formatting - Learn C++
It's fine to use either tabs or spaces for indentation (most IDEs have a setting where you can convert a tab press into...
Read more >How to insert spaces/tabs in text using HTML/CSS?
Spacing can be added using HTML and CSS by 3 approaches: ... CSS property is set the number of spaces each tab character...
Read more >Formatting - Coding Style - Read the Docs
do not need to emphasis the keywords, it is clear enough while (condition) { do_something(); } ... NO space after unary operators, such...
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 Free
Top 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
I think enhancing
no-tabs
to support tolerating tabs at the beginning of the line but forbidding them elsewhere makes a lot of sense.Thanks for your interest in improving ESLint. Unfortunately, it looks like this issue didn’t get consensus from the team, so I’m closing it. We define consensus as having three 👍s from team members, as well as a team member willing to champion the proposal. This is a high bar by design – we can’t realistically accept and maintain every feature request in the long term, so we only accept feature requests which are useful enough that there is consensus among the team that they’re worth adding.
Since ESLint is pluggable and can load custom rules at runtime, the lack of consensus among the ESLint team doesn’t need to be a blocker for you using this in your project, if you’d find it useful. It just means that you would need to implement the rule yourself, rather than using a bundled rule that is packaged with ESLint.