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.

[no-tabs] allow exceptions

See original GitHub issue

What rule do you want to change?

no-tabs (currently on eslint 6.5.1)

Does this change cause the rule to produce more or fewer warnings?

fewer warnings

How will the change be implemented?

New option.

Please provide some example code that this change will affect:

if (inTabIndentedCode) {
⇥	// if (commented) {
⇥	// ⇥	codeInBlocks();
⇥	// }
⇥	hasProblems();
}
const also = some`
⇥	string⇥	${literals}
⇥	use⇥	${tabulators}
`;
… // rules:
	'indent': ['error', 'tab'],
	'no-tabs': ['error', { 'allowIndentationTabs': true }],

What does the rule currently do for this code?

It complains about Unexpected tab character inside the commented-out code and in the string string literal, which is too strict imo.

What will the rule do after it’s changed?

I would propose to add some configuration options that either

  • could allow lines matching a certain regex
  • could allow lines in a certain AST context, e.g. string literals or comments

so that the rule would accept above code examples but still complain about tabulator characters elsewhere.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
mdjermanoviccommented, Aug 22, 2022

Closing per our rules policies.

3reactions
kaicataldocommented, Nov 1, 2019

Understood, thank you. I think it would make sense to make the configuration option also accept an object with the following signature:

{
    allowIndentationTabs?: boolean,
    allowInComments?: boolean,
    allowInStrings?: boolean,
}

We could do this in a backwards compatible way and eventually remove the current string option in a future major release.

Thoughts?

Read more comments on GitHub >

github_iconTop Results From Across the Web

[solved] eslint no-tabs errors | Quasar Framework Community
I use atom and the eslint atom package for other work. I keep an eslintrc.js file in my home directory for all projects....
Read more >
no-tabs - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
Style Rule Set | Detekt
This rule allows to set a list of rules whose suppression is forbidden. ... NoTabs​. This rule reports if tabs are used in...
Read more >
Best Practices for using Exceptions in Uniface
Best Practices for using Exceptions in Uniface ... Enable Referential Integrity in a Microsoft SQL Server Database ... 3024 No tabs allowed.
Read more >
Select no tabs in a UITabBar - Stack Overflow
... a part of UITabBarController then application will crash with exception: 'Directly modifying a tab bar managed by a tab bar controller is...
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