ter-no-mixed-spaces-and-tabs (ESLint: no-mixed-spaces-and-tabs)
disallow mixed spaces and tabs for indentation (recommended)
Using only one of tabs or spaces for indentation leads to more consistent editor behavior, cleaner diffs in version control, and easier programmatic manipulation.
This rule takes an object argument with an optional type
property which can be set to:
spaces
enforces consistent spaces for indentation.tabs
enforces consistent tabs for indentation.
If the above is not provided, the rule will enforce either all tabs or all spaces on each line, although different lines may differ between tabs and spaces.
Optionally, a smartTabs
boolean property can be specified. If set to true, smart tabs
allow mixing tabs and spaces if tabs are used for indentation and spaces for alignment, eg.
function main() {
// --->const a = 1,
// --->......b = 2;
const a = 1,
b = 2;
}
"ter-no-mixed-spaces-and-tabs": { "type": "tabs" }
"ter-no-mixed-spaces-and-tabs": { "type": "spaces" }
"ter-no-mixed-spaces-and-tabs": { "smartTabs": true }
"ter-no-mixed-spaces-and-tabs": { "type": "tabs", "smartTabs": true }
{
"type": "array",
"items": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"tabs",
"spaces"
]
},
"smartTabs": {
"type": "boolean"
}
},
"additionalProperties": false
}
],
"minLength": 0,
"maxLength": 1
}