no-empty-enum
NOTE: this rule is part of the
推荐
rule set.Enable full set in
deno.json
:{ "lint": { "rules": { "tags": ["推荐"] } } }
Enable full set using the Deno CLI:
deno lint --rules-tags=推荐
This rule can be explictly included to or excluded from the rules present in the current tag by adding it to the
include
or exclude
array in deno.json
:{ "lint": { "rules": { "include": ["no-empty-enum"], "exclude": ["no-empty-enum"] } } }
不允许声明空枚举。
一个没有成员的枚举没有任何意义。此规则将捕获这些情况,将其视为不必要的代码或错误的空实现。
无效:
enum Foo {}
有效:
enum Foo {
ONE = "ONE",
}