]> git.proxmox.com Git - pve-eslint.git/blame - eslint/docs/rules/no-tabs.md
bump version to 8.4.0-3
[pve-eslint.git] / eslint / docs / rules / no-tabs.md
CommitLineData
eb39fafa
DC
1# disallow all tabs (no-tabs)
2
3Some style guides don't allow the use of tab characters at all, including within comments.
4
5## Rule Details
6
7This rule looks for tabs anywhere inside a file: code, comments or anything else.
8
9Examples of **incorrect** code for this rule:
10
11```js
12var a \t= 2;
13
14/**
15* \t\t it's a test function
16*/
17function test(){}
18
19var x = 1; // \t test
20```
21
22Examples of **correct** code for this rule:
23
24```js
25var a = 2;
26
27/**
28* it's a test function
29*/
30function test(){}
31
32var x = 1; // test
33```
34
35### Options
36
37This rule has an optional object option with the following properties:
38
39* `allowIndentationTabs` (default: false): If this is set to true, then the rule will not report tabs used for indentation.
40
41#### allowIndentationTabs
42
43Examples of **correct** code for this rule with the `allowIndentationTabs: true` option:
44
45```js
46/* eslint no-tabs: ["error", { allowIndentationTabs: true }] */
47
48function test() {
49\tdoSomething();
50}
51
52\t// comment with leading indentation tab
53```
54
55## When Not To Use It
56
57If you have established a standard where having tabs is fine, then you can disable this rule.
58
59## Compatibility
60
61* **JSCS**: [disallowTabs](https://jscs-dev.github.io/rule/disallowTabs)