规则配置
¥Rules configuration
规则由名称和配置数组组成。配置数组包含:
¥Rules are made up by a name and a configuration array. The configuration array contains:
级别
[0..2]
:0
禁用该规则。对于1
,它将被视为警告;对于2
,它将被视为错误。¥Level
[0..2]
:0
disables the rule. For1
it will be considered a warning for2
an error.适用
always|never
:never
反转规则。¥Applicable
always|never
:never
inverts the rule.值:此规则使用的值。
¥Value: value to use for this rule.
规则配置要么是 array
类型,位于以规则名称为键的规则 object
上的键上,要么是函数类型,返回类型为 array
或 Promise<array>
。这意味着支持以下所有符号。
¥Rule configurations are either of type array
residing on a key with the rule's name as key on the rules object
or of type function returning type array
or Promise<array>
. This means all of the following notations are supported.
普通数组
¥Plain array
export default {
// ...
rules: {
"header-max-length": [0, "always", 72],
},
// ...
};
返回数组的函数
¥Function returning array
export default {
// ...
rules: {
"header-max-length": () => [0, "always", 72],
},
// ...
};
异步函数返回数组
¥Async function returning array
export default {
// ...
rules: {
"header-max-length": async () => [0, "always", 72],
},
// ...
};