Rule: indent
Enforces indentation with tabs or spaces.
Rationale
Using only one of tabs or spaces for indentation leads to more consistent editor behavior, cleaner diffs in version control, and easier programmatic manipulation.
Notes:
Has Fixer
Config
One of the following arguments must be provided:
spaces
enforces consistent spaces.tabs
enforces consistent tabs.
A second optional argument specifies indentation size:
2
enforces 2 space indentation.4
enforces 4 space indentation.
Indentation size is required for auto-fixing, but not for rule checking.
NOTE: auto-fixing will only convert invalid indent whitespace to the desired type, it will not fix invalid whitespace sizes.
Config examples
"indent": [true, "spaces"]
"indent": [true, "spaces", 4]
"indent": [true, "tabs", 2]
Schema
{ "type": "array", "items": [ { "type": "string", "enum": [ "tabs", "spaces" ] }, { "type": "number", "enum": [ 2, 4 ] } ], "minLength": 0, "maxLength": 5 }