规则类型
多个规则类型
规则类型即规则页面中的“推荐(recommended)”、“可修复(fixable)”和“有建议(hasSuggestions)”。它们都使用 ruleCategories
宏进行渲染(从 /components/rule-categories.macro.html
中导入)。每种类型都有对应的独立宏。
{ % from 'components/rule-categories.macro.html' import ruleCategories % }
{ { ruleCategories({
recommended: true,
fixable: true,
hasSuggestions: true
}) } }
示例
The "extends": "eslint:recommended"
property in a configuration file enables this rule
Some problems reported by this rule are automatically fixable by the --fix
command line option
Some problems reported by this rule are manually fixable by editor suggestions
单个规则类型
对于每条规则,你可以使用对应的类型简码渲染其所属类别:
{ % recommended % }
{ % fixable % }
{ % hasSuggestions % }
示例
if the “extends”: “eslint:recommended”
property in a configuration file enables the rule.
if some problems reported by the rule are automatically fixable by the –fix
command line option
if some problems reported by the rule are manually fixable by editor suggestions