Eslint
migration
byCodemod

Biome/Migrate Rules

/icons/calendar.svg

Last update

Jul 24, 2024

This codemod replaces configuration files for ESLint with corresponding biome.json for all the found rules. It also replaces Prettier configuration.

Note:

This codemod accepts manual user input, which is required to migrate away from eslint. In order to run it properly, run the following command:

npx eslint --print-config <path-to-a-file-that-eslint-checks> | codemod eslint/biome/migrate-rules

It's important that you pass these rules to the codemod, because our codemods are limited in access for security purposes and have no access to most node features that could maliciously affect your system.

This codemod requires internet connection.

Example

package.json

Before

{
"name": "package-name",
"dependencies": {
"prettier": "^3.1.0",
"prettier-plugin-tailwindcss": "^0.5.4",
"@tanstack/eslint-plugin-query": "^4.29.25",
"@someorg/prettier-config": "^1.1.1"
},
"devDependencies": {
"eslint-plugin-airbnb": "^10.2.0",
"eslint": "^10.2.0",
"eslint-plugin-prettier": "^10.2.0",
"eslint-config-prettier": "^10.2.0"
},
"main": "./dist/index.cjs",
"scripts": {
"start": "pnpm run build:cjs && node ./dist/index.cjs",
"lint:eslint": "eslint . --fix",
"lint:prettier": "prettier --write ."
},
"eslintIgnore": ["ignore-key"],
"files": [
"prettier-test-no-replace",
"README.md",
".codemodrc.json",
"./dist/index.cjs" ],
"lint-staged": {
"*.js": "eslint --fix",
"*.ts": "eslint --fix"
},
"type": "module"
}

After

{
"name": "package-name",
"dependencies": {},
"devDependencies": {
"@biomejs/biome": "1.5.3"
},
"main": "./dist/index.cjs",
"scripts": {
"start": "pnpm run build:cjs && node ./dist/index.cjs",
"lint:eslint": "pnpm dlx @biomejs/biome lint . --apply",
"lint:prettier": "pnpm dlx @biomejs/biome format --write .",
"NOTE": "You can apply both linter, formatter and import ordering by using https://biomejs.dev/reference/cli/#biome-check",
"NOTE2": "There is an ongoing work to release prettier-tailwind-plugin alternative: https://biomejs.dev/linter/rules/use-sorted-classes/, https://github.com/biomejs/biome/issues/1274"
},
"files": [
"prettier-test-no-replace",
"README.md",
".codemodrc.json",
"./dist/index.cjs" ],
"lint-staged": {
"*.js": "pnpm dlx @biomejs/biome lint --apply",
"*.ts": "pnpm dlx @biomejs/biome lint --apply"
},
"type": "module"
}

.eslintrc.json

Before

{
"rules": [...]
}

After

Removed and replaced with corresponding rules in biome.json

.prettierrc

Before

{
"printWidth": 80
}

After

Removed and replaced with corresponding values in biome.json

biome.json

{
"linter": {
"ignore": [
"ignore-key",
"dist",
"build",
"pnpm-lock.yaml",
"node_modules"
],
"rules": {
"suspicious": {
"noDoubleEquals": "warn",
"noAssignInExpressions": "warn"
},
"correctness": {
"noUnusedVariables": "off"
}
}
},
"formatter": {
"ignore": [],
"indentStyle": "tab"
}
}

Build custom codemods

Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community

background illustrationGet Started Now