Skip to content

Commit

Permalink
fix(migrate-eslint): load non-conventional shared config name (#4538)
Browse files Browse the repository at this point in the history
  • Loading branch information
Conaclos authored Nov 14, 2024
1 parent 927b75b commit 42da14f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b
- `biome migrate eslint` now correctly resolves scoped package named `eslint-config` with a path.
Contributed by @Conaclos

- `biome migrate eslint` now correctly handles shared ESLint configuration that don't follow the ESLint naming convention ([#4528](https://github.com/biomejs/biome/issues/4528)).

ESLint recommends that a package that exports a shared configuration be prefixed with `eslint-config-` or simply named `eslint-config`.
This is only a recommendation.
Packages that export shared configurations can have arbitrary names.
Biome is now able to load any package.

Contributed by @Conaclos

### Configuration

### Editors
Expand Down
9 changes: 8 additions & 1 deletion crates/biome_cli/src/execute/migrate/eslint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,17 @@ fn load_eslint_extends_config(
} else {
EslintPackage::Config.resolve_name(name)
};
// Try to load `module_name` or else try to load diretcly `name`.
let node::Resolution {
content,
resolved_path,
} = node::load_config(&module_name)?;
} = node::load_config(&module_name).or_else(|err| {
if module_name != name {
node::load_config(name)
} else {
Err(err)
}
})?;
let deserialized = deserialize_from_json_str::<eslint_eslint::LegacyConfigData>(
&content,
JsonParserOptions::default(),
Expand Down
2 changes: 1 addition & 1 deletion packages/@biomejs/backend-jsonrpc/src/workspace.ts

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

2 changes: 1 addition & 1 deletion packages/@biomejs/biome/configuration_schema.json

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

0 comments on commit 42da14f

Please sign in to comment.