Skip to main content

block-spacing

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

Disallow or enforce spaces inside of blocks after opening block and before closing block.

🔧

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


此规则扩展了基本 eslint/block-spacing 规则。 此版本添加了对 TypeScript 相关块(接口、对象类型字面量和枚举)的支持。

英:This rule extends the base eslint/block-spacing rule. This version adds support for TypeScript related blocks (interfaces, object type literals and enums).

如何使用

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

选项

参见 eslint/block-spacing 选项

资源

摘自 ❤️ ESLint 内核