Skip to main content

indent

danger
This rule will soon be moved to eslint-stylistic. See What About Formatting? for more information.

Enforce consistent indentation.

🔧

此规则报告的一些问题可通过 --fix ESLint 命令行选项自动修复


警告

警告

使用本规则前请先阅读 问题 #1824:缩进规则的问题

英:Please read Issue #1824: Problems with the indent rule before using this rule!

此规则扩展了基本 eslint/indent 规则。 它增加了对 TypeScript 节点的支持。

英:This rule extends the base eslint/indent rule. It adds support for TypeScript nodes.

如何使用

.eslintrc.cjs
module.exports = {
"rules": {
// Note: you must disable the base rule as it can report incorrect errors
"indent": "off",
"@typescript-eslint/indent": "error"
}
};
在线运行试试这个规则 ↗

选项

参见 eslint/indent 选项

资源

摘自 ❤️ ESLint 内核