Skip to main content

semi

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

Require or disallow semicolons instead of ASI.

🔧

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


此规则扩展了基本 eslint/semi 规则。 它增加了对需要分号的 TypeScript 功能的支持。

英:This rule extends the base eslint/semi rule. It adds support for TypeScript features that require semicolons.

另请参见 @typescript-eslint/member-delimiter-style 规则,它允许你指定 typeinterface 成员的分隔符。

英:See also the @typescript-eslint/member-delimiter-style rule, which allows you to specify the delimiter for type and interface members.

如何使用

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

选项

参见 eslint/semi 选项

资源

摘自 ❤️ ESLint 内核