feat(linter): add style category and change no-empty-interface to style

It's officially change in typescript-eslint
This commit is contained in:
Boshen 2023-07-28 12:19:14 +08:00
parent ad51157ea9
commit 1bc564eafc
3 changed files with 7 additions and 2 deletions

View file

@ -37,8 +37,10 @@ pub enum RuleCategory {
Correctness,
/// Code that is most likely wrong or useless
Suspicious,
/// Pedantic
/// Lints which are rather strict or have occasional false positives
Pedantic,
/// Code that should be written in a more idiomatic way
Style,
/// Lints which prevent the use of language and library features
/// The restriction category should, emphatically, not be enabled as a whole.
/// The contained lints may lint against perfectly reasonable code, may not have an alternative suggestion,
@ -55,6 +57,7 @@ impl RuleCategory {
"correctness" => Some(Self::Correctness),
"suspicious" => Some(Self::Suspicious),
"pedantic" => Some(Self::Pedantic),
"style" => Some(Self::Style),
"restriction" => Some(Self::Restriction),
"nursery" => Some(Self::Nursery),
_ => None,
@ -68,6 +71,7 @@ impl fmt::Display for RuleCategory {
Self::Correctness => write!(f, "Correctness"),
Self::Suspicious => write!(f, "Suspicious"),
Self::Pedantic => write!(f, "Pedantic"),
Self::Style => write!(f, "Style"),
Self::Restriction => write!(f, "Restriction"),
Self::Nursery => write!(f, "Nursery"),
}

View file

@ -40,7 +40,7 @@ declare_oxc_lint!(
/// interface Bar extends Foo {}
/// ```
NoEmptyInterface,
correctness
style
);
impl Rule for NoEmptyInterface {

View file

@ -62,6 +62,7 @@ pub fn declare_oxc_lint(metadata: LintRuleMeta) -> TokenStream {
"correctness" => quote! { RuleCategory::Correctness },
"suspicious" => quote! { RuleCategory::Suspicious },
"pedantic" => quote! { RuleCategory::Pedantic },
"style" => quote! { RuleCategory::Style },
"restriction" => quote! { RuleCategory::Restriction },
"nursery" => quote! { RuleCategory::Nursery },
_ => panic!("invalid rule category"),