Skip to content

Commit

Permalink
feat(linter): add a perf category (#1625)
Browse files Browse the repository at this point in the history
relates to #1607
  • Loading branch information
Boshen authored Dec 4, 2023
1 parent 09618e9 commit 32504ca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crates/oxc_linter/src/rule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ pub enum RuleCategory {
Suspicious,
/// Lints which are rather strict or have occasional false positives
Pedantic,
/// Code that can be written to run faster
Perf,
/// Code that should be written in a more idiomatic way
Style,
/// Lints which prevent the use of language and library features
Expand All @@ -57,6 +59,7 @@ impl RuleCategory {
"correctness" => Some(Self::Correctness),
"suspicious" => Some(Self::Suspicious),
"pedantic" => Some(Self::Pedantic),
"perf" => Some(Self::Perf),
"style" => Some(Self::Style),
"restriction" => Some(Self::Restriction),
"nursery" => Some(Self::Nursery),
Expand All @@ -71,6 +74,7 @@ impl fmt::Display for RuleCategory {
Self::Correctness => write!(f, "Correctness"),
Self::Suspicious => write!(f, "Suspicious"),
Self::Pedantic => write!(f, "Pedantic"),
Self::Perf => write!(f, "Perf"),
Self::Style => write!(f, "Style"),
Self::Restriction => write!(f, "Restriction"),
Self::Nursery => write!(f, "Nursery"),
Expand Down
1 change: 1 addition & 0 deletions crates/oxc_macros/src/declare_oxc_lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pub fn declare_oxc_lint(metadata: LintRuleMeta) -> TokenStream {
"correctness" => quote! { RuleCategory::Correctness },
"suspicious" => quote! { RuleCategory::Suspicious },
"pedantic" => quote! { RuleCategory::Pedantic },
"perf" => quote! { RuleCategory::Perf },
"style" => quote! { RuleCategory::Style },
"restriction" => quote! { RuleCategory::Restriction },
"nursery" => quote! { RuleCategory::Nursery },
Expand Down

0 comments on commit 32504ca

Please sign in to comment.