quotes
danger
This rule will soon be moved to eslint-stylistic. See What About Formatting? for more information.
Enforce the consistent use of either backticks, double, or single quotes.
🔧
此规则报告的一些问题可通过 --fix
ESLint 命令行选项自动修复。
此规则扩展了基本 eslint/quotes
规则。
它增加了对 TypeScript 功能的支持,允许引用名称,但不允许反引号引用名称。
英:This rule extends the base eslint/quotes
rule.
It adds support for TypeScript features which allow quoted names, but not backtick quoted names.
如何使用
.eslintrc.cjs
module.exports = {
"rules": {
// Note: you must disable the base rule as it can report incorrect errors
"quotes": "off",
"@typescript-eslint/quotes": "error"
}
};
选项
参见 eslint/quotes
选项。
资源
摘自 ❤️ ESLint 内核