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