title | rule_type |
---|---|
no-tabs |
layout |
This rule was deprecated in ESLint v8.53.0. Please use the corresponding rule in @stylistic/eslint-plugin-js
.
Some style guides don't allow the use of tab characters at all, including within comments.
This rule looks for tabs anywhere inside a file: code, comments or anything else.
Examples of incorrect code for this rule:
::: incorrect
/* eslint no-tabs: "error" */
var a = 2;
/**
* it's a test function
*/
function test(){}
var x = 1; // test
:::
Examples of correct code for this rule:
::: correct
/* eslint no-tabs: "error" */
var a = 2;
/**
* it's a test function
*/
function test(){}
var x = 1; // test
:::
This rule has an optional object option with the following properties:
allowIndentationTabs
(default: false): If this is set to true, then the rule will not report tabs used for indentation.
Examples of correct code for this rule with the allowIndentationTabs: true
option:
::: correct
/* eslint no-tabs: ["error", { allowIndentationTabs: true }] */
function test() {
doSomething();
}
// comment with leading indentation tab
:::
If you have established a standard where having tabs is fine, then you can disable this rule.
- JSCS: disallowTabs