Add a command to migrate from ESLint
biome migrate eslint
allows you to migrate an ESLint configuration to Biome.
The command supports legacy ESLint configurations and new flat ESLint configurations.
Legacy ESLint configurations using the YAML format are not supported.
When loading a legacy ESLint configuration, Biome resolves the extends
field.
It resolves both shared configurations and plugin presets!
To do this, it invokes Node.js.
Biome relies on the metadata of its rules to determine the equivalent rule of an ESLint rule.
A Biome rule is either inspired or roughly identical to an ESLint rules.
By default, inspired and nursery rules are excluded from the migration.
You can use the CLI flags --include-inspired
and --include-nursery
to migrate them as well.
Note that this is a best-effort approach.
You are not guaranteed to get the same behavior as ESLint.
Given the following ESLint configuration:
{
"ignore_patterns": ["**/*.test.js"],
"globals": { "var2": "readonly" },
"rules": {
"eqeqeq": "error"
},
"overrides": [{
"files": ["lib/*.js"],
"rules": {
"default-param-last": "off"
}
}]
}
biome migrate eslint --write
changes the Biome configuration as follows:
{
"linter": {
"rules": {
"recommended": false,
"suspicious": {
"noDoubleEquals": "error"
}
}
},
"javascript": { "globals": ["var2"] },
"overrides": [{
"include": ["lib/*.js"],
"linter": {
"rules": {
"style": {
"useDefaultParameterLast": "off"
}
}
}
}]
}
Also, if the working directory contains .eslintignore
, then Biome migrates the glob patterns.
Nested .eslintignore
in subdirectories and negated glob patterns are not supported.
If you find any issue, please don't hesitate to report them.
Contributed by @Conaclos