From cd6e830b48d06939ca42f580dd31a858846f0884 Mon Sep 17 00:00:00 2001 From: Victorien Elvinger Date: Mon, 3 Jun 2024 23:31:00 +0200 Subject: [PATCH] refactor(useThrowOnlyError): fix sources (#3053) --- .../migrate/eslint_any_rule_to_biome.rs | 24 +++++++++---------- .../src/lint/nursery/use_throw_only_error.rs | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/crates/biome_cli/src/execute/migrate/eslint_any_rule_to_biome.rs b/crates/biome_cli/src/execute/migrate/eslint_any_rule_to_biome.rs index 3a7a10357d4c..4e2bdd272e6a 100644 --- a/crates/biome_cli/src/execute/migrate/eslint_any_rule_to_biome.rs +++ b/crates/biome_cli/src/execute/migrate/eslint_any_rule_to_biome.rs @@ -238,6 +238,18 @@ pub(crate) fn migrate_eslint_any_rule( .get_or_insert(Default::default()); rule.set_level(rule_severity.into()); } + "@typescript-eslint/only-throw-error" => { + if !options.include_inspired { + results.has_inspired_rules = true; + return false; + } + if !options.include_nursery { + return false; + } + let group = rules.nursery.get_or_insert_with(Default::default); + let rule = group.use_throw_only_error.get_or_insert(Default::default()); + rule.set_level(rule_severity.into()); + } "@typescript-eslint/parameter-properties" => { if !options.include_inspired { results.has_inspired_rules = true; @@ -1159,18 +1171,6 @@ pub(crate) fn migrate_eslint_any_rule( .get_or_insert(Default::default()); rule.set_level(rule_severity.into()); } - "only-throw-error" => { - if !options.include_inspired { - results.has_inspired_rules = true; - return false; - } - if !options.include_nursery { - return false; - } - let group = rules.nursery.get_or_insert_with(Default::default); - let rule = group.use_throw_only_error.get_or_insert(Default::default()); - rule.set_level(rule_severity.into()); - } "operator-assignment" => { let group = rules.style.get_or_insert_with(Default::default); let rule = group.use_shorthand_assign.get_or_insert(Default::default()); diff --git a/crates/biome_js_analyze/src/lint/nursery/use_throw_only_error.rs b/crates/biome_js_analyze/src/lint/nursery/use_throw_only_error.rs index b8b40fcbc583..aafe97c731a6 100644 --- a/crates/biome_js_analyze/src/lint/nursery/use_throw_only_error.rs +++ b/crates/biome_js_analyze/src/lint/nursery/use_throw_only_error.rs @@ -53,7 +53,7 @@ declare_rule! { version: "next", name: "useThrowOnlyError", language: "js", - sources: &[RuleSource::Eslint("no-throw-literal"), RuleSource::EslintTypeScript("no-throw-literal"), RuleSource::Eslint("only-throw-error")], + sources: &[RuleSource::Eslint("no-throw-literal"), RuleSource::EslintTypeScript("no-throw-literal"), RuleSource::EslintTypeScript("only-throw-error")], source_kind: RuleSourceKind::Inspired, recommended: false, }