You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/rules/indent.md
+23-2
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,6 @@ This rule enforces a consistent indentation style in `.svelte`. The default styl
23
23
24
24
<!--eslint-skip-->
25
25
<!-- prettier-ignore -->
26
-
27
26
```html
28
27
<script>
29
28
/* eslint @ota-meshi/svelte/indent: "error" */
@@ -51,6 +50,26 @@ CLICK ME!
51
50
52
51
</eslint-code-block>
53
52
53
+
::: warning Note
54
+
This rule only checks `.svelte` files and does not interfere with other `.js` files. Unfortunately the default `indent` rule when turned on will try to lint both, so in order to make them complementary you can use `overrides` setting and disable `indent` rule on `.svelte` files:
55
+
:::
56
+
57
+
```json
58
+
{
59
+
"rules": {
60
+
"@ota-meshi/svelte/indent": "error"
61
+
},
62
+
"overrides": [
63
+
{
64
+
"files": ["*.svelte"],
65
+
"rules": {
66
+
"indent": "off"
67
+
}
68
+
}
69
+
]
70
+
}
71
+
```
72
+
54
73
## :wrench: Options
55
74
56
75
```json
@@ -60,7 +79,8 @@ CLICK ME!
60
79
{
61
80
"indent": 2,
62
81
"ignoredNodes": [],
63
-
"switchCase": 1
82
+
"switchCase": 1,
83
+
"alignAttributesVertically": false
64
84
}
65
85
]
66
86
}
@@ -69,6 +89,7 @@ CLICK ME!
69
89
-`indent` (`number | "tab"`) ... The type of indentation. Default is `2`. If this is a number, it's the number of spaces for one indent. If this is `"tab"`, it uses one tab for one indent.
70
90
-`ignoredNodes` ... Can be used to disable indentation checking for any AST node. This accepts an array of [selectors](https://eslint.org/docs/developer-guide/selectors). If an AST node is matched by any of the selectors, the indentation of tokens which are direct children of that node will be ignored. This can be used as an escape hatch to relax the rule if you disagree with the indentation that it enforces for a particular syntactic pattern.
71
91
-`switchCase` ... Enforces indentation level for case clauses in switch statements. Default is `1`.
92
+
-`alignAttributesVertically` ... Condition for whether attributes should be vertically aligned to the first attribute in multiline case or not. Default is `false`
0 commit comments