Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/add-e18e-rule-source.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@biomejs/biome": patch
---

Added e18e ESLint plugin as a recognized rule source. Six Biome rules now reference their e18e equivalents: `useAtIndex`, `useExponentiationOperator`, `noPrototypeBuiltins`, `useDateNow`, `useSpread`, and `useObjectSpread`.
7 changes: 7 additions & 0 deletions crates/biome_analyze/src/rule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ pub enum RuleSource<'a> {
Eslint(&'a str),
/// Rules from [Eslint Plugin Barrel Files](https://github.com/thepassle/eslint-plugin-barrel-files)
EslintBarrelFiles(&'a str),
/// Rules from [e18e ESLint Plugin](https://github.com/e18e/eslint-plugin)
EslintE18e(&'static str),
/// Rules from [GraphQL-ESLint](https://github.com/graphql-hive/graphql-eslint)
EslintGraphql(&'a str),
/// Rules from [Eslint Plugin Import](https://github.com/import-js/eslint-plugin-import)
Expand Down Expand Up @@ -181,6 +183,7 @@ impl<'a> std::fmt::Display for RuleSource<'a> {
Self::DenoLint(_) => write!(f, "Deno Lint"),
Self::Eslint(_) => write!(f, "ESLint"),
Self::EslintBarrelFiles(_) => write!(f, "eslint-plugin-barrel-files"),
Self::EslintE18e(_) => write!(f, "@e18e/eslint-plugin"),
Self::EslintGraphql(_) => write!(f, "GraphQL-ESLint"),
Self::EslintImport(_) => write!(f, "eslint-plugin-import"),
Self::EslintImportAccess(_) => write!(f, "eslint-plugin-import-access"),
Expand Down Expand Up @@ -275,6 +278,7 @@ impl<'a> RuleSource<'a> {
Self::Stylelint(_) => 34,
Self::EslintTurbo(_) => 35,
Self::HtmlEslint(_) => 36,
Self::EslintE18e(_) => 37,
}
}

Expand All @@ -298,6 +302,7 @@ impl<'a> RuleSource<'a> {
| Self::DenoLint(rule_name)
| Self::Eslint(rule_name)
| Self::EslintBarrelFiles(rule_name)
| Self::EslintE18e(rule_name)
| Self::EslintGraphql(rule_name)
| Self::EslintImport(rule_name)
| Self::EslintImportAccess(rule_name)
Expand Down Expand Up @@ -373,6 +378,7 @@ impl<'a> RuleSource<'a> {
Self::EslintVueJs(_) => "vue",
Self::EslintTurbo(_) => "turbo",
Self::HtmlEslint(_) => "@html-eslint",
Self::EslintE18e(_) => "e18e",
}
}

Expand All @@ -390,6 +396,7 @@ impl<'a> RuleSource<'a> {
Self::DenoLint(rule_name) => format!("https://lint.deno.land/rules/{rule_name}"),
Self::Eslint(rule_name) => format!("https://eslint.org/docs/latest/rules/{rule_name}"),
Self::EslintBarrelFiles(rule_name) => format!("https://github.com/thepassle/eslint-plugin-barrel-files/blob/main/docs/rules/{rule_name}.md"),
Self::EslintE18e(_) => "https://github.com/e18e/eslint-plugin".to_string(),
Self::EslintGraphql(rule_name) => format!("https://the-guild.dev/graphql/eslint/rules/{rule_name}"),
Self::EslintImport(rule_name) => format!("https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/{rule_name}.md"),
Self::EslintImportAccess(_) => "https://github.com/uhyo/eslint-plugin-import-access".to_string(),
Expand Down
44 changes: 44 additions & 0 deletions crates/biome_cli/src/execute/migrate/eslint_any_rule_to_biome.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ info: css/tailwind/utility.css
@utility tab-4{tab-size:4;}

@utility tab-*{tab-size:--value(--tab-size-*);}

@utility px-*{padding-inline:--value(--padding-inline-*);}

```


Expand Down Expand Up @@ -68,6 +71,10 @@ Trailing newline: true
tab-size: --value(--tab-size-*);
}

@utility px-* {
padding-inline: --value(--padding-inline-*);
}

```

## Output 1
Expand Down Expand Up @@ -108,4 +115,8 @@ Trailing newline: true
tab-size: --value(--tab-size-*);
}

@utility px-* {
padding-inline: --value(--padding-inline-*);
}

```
5 changes: 4 additions & 1 deletion crates/biome_js_analyze/src/lint/complexity/use_date_now.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ declare_lint_rule! {
version: "1.8.0",
name: "useDateNow",
language: "js",
sources: &[RuleSource::EslintUnicorn("prefer-date-now").same()],
sources: &[
RuleSource::EslintUnicorn("prefer-date-now").same(),
RuleSource::EslintE18e("prefer-date-now").same(),
],
recommended: true,
severity: Severity::Warning,
fix_kind: FixKind::Unsafe,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ declare_lint_rule! {
name: "useConsistentEnumValueType",
language: "ts",
recommended: false,
domains: &[RuleDomain::Project],
domains: &[RuleDomain::Types],
sources: &[RuleSource::EslintTypeScript("no-mixed-enums").same()],
}
}
Expand Down
5 changes: 4 additions & 1 deletion crates/biome_js_analyze/src/lint/nursery/use_spread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ declare_lint_rule! {
version: "2.3.6",
name: "useSpread",
language: "js",
sources: &[RuleSource::Eslint("prefer-spread").same()],
sources: &[
RuleSource::Eslint("prefer-spread").same(),
RuleSource::EslintE18e("prefer-spread-syntax").inspired(),
],
recommended: true,
fix_kind: FixKind::Unsafe,
}
Expand Down
5 changes: 4 additions & 1 deletion crates/biome_js_analyze/src/lint/style/use_at_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ declare_lint_rule! {
language: "js",
recommended: false,
severity: Severity::Information,
sources: &[RuleSource::EslintUnicorn("prefer-at").inspired()],
sources: &[
RuleSource::EslintUnicorn("prefer-at").inspired(),
RuleSource::EslintE18e("prefer-array-at").same(),
],
fix_kind: FixKind::Unsafe,
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ declare_lint_rule! {
version: "1.0.0",
name: "useExponentiationOperator",
language: "js",
sources: &[RuleSource::Eslint("prefer-exponentiation-operator").same()],
sources: &[
RuleSource::Eslint("prefer-exponentiation-operator").same(),
RuleSource::EslintE18e("prefer-exponentiation-operator").same(),
],
recommended: true,
severity: Severity::Information,
fix_kind: FixKind::Safe,
Expand Down
5 changes: 4 additions & 1 deletion crates/biome_js_analyze/src/lint/style/use_object_spread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ declare_lint_rule! {
version: "2.0.0",
name: "useObjectSpread",
language: "js",
sources: &[RuleSource::Eslint("prefer-object-spread").same()],
sources: &[
RuleSource::Eslint("prefer-object-spread").same(),
RuleSource::EslintE18e("prefer-spread-syntax").inspired(),
],
recommended: false,
fix_kind: FixKind::Safe,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ declare_lint_rule! {
sources: &[
RuleSource::Eslint("no-prototype-builtins").same(),
RuleSource::Eslint("prefer-object-has-own").same(),
RuleSource::EslintE18e("prefer-object-has-own").same(),
],
recommended: true,
severity: Severity::Warning,
Expand Down
4 changes: 1 addition & 3 deletions crates/biome_js_analyze/src/services/typed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ impl FromServices for TypedService {
.iter()
.any(|d| d == &RuleDomain::Types);
if !has_project_domain {
panic!(
"The rule {rule_key} uses TypedService, but it is not in the TypeAware domain."
);
panic!("The rule {rule_key} uses TypedService, but it is not in the Types domain.");
}
}

Expand Down
Loading