Biome.js config
Here are my Biome.js configs from newest to oldest.
Installation
Install biome as development dependency.
pnpm add -D -E @biomejs/biome
Biome v2
{
"$schema": "https://biomejs.dev/schemas/2.0.5/schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
},
"formatter": {
"enabled": true,
"indentStyle": "tab",
"indentWidth": 2,
"lineWidth": 90,
"includes": ["src/**"]
},
"javascript": {
"formatter": {
"arrowParentheses": "always",
"quoteStyle": "double",
"jsxQuoteStyle": "double",
"bracketSameLine": false,
"bracketSpacing": true,
"semicolons": "asNeeded",
"trailingCommas": "none"
}
},
"json": {
"formatter": {
"indentStyle": "tab"
}
},
"linter": {
"enabled": true,
"includes": ["src/**", "!.next/**", "!src/ui/**"],
"rules": {
"recommended": true,
"correctness": {
"noUnusedImports": {
"level": "warn",
"fix": "safe"
},
"noUnusedVariables": "warn",
"noUnsafeOptionalChaining": "error",
"noUnsafeFinally": "error"
},
"nursery": {
"useUniqueElementIds": "off",
"useSortedClasses": {
"level": "warn",
"fix": "safe",
"options": {
"attributes": ["className"],
"functions": ["cn", "clsx", "twMerge"]
}
}
}
}
},
"assist": {
"enabled": true,
"actions": {
"source": {
"organizeImports": {
"level": "on",
"options": {
"groups": [
":BLANK_LINE:",
":NODE:",
"./node_modules/**",
":PACKAGE:",
":BLANK_LINE:",
[
"./**",
"@/**",
"@/lib/**",
"@/utils/**",
"@/config",
"!@/components/**",
"!@/modules/**"
],
":BLANK_LINE:",
["@/components/**", "@/modules/**"]
]
}
}
}
}
}
}
.vscode config for Biome
Also found in (here)[https://joseavr.com/notes/vscode-config#project-based-settings].
.vscode/settings.json
{
// Set formatter Biome
"editor.defaultFormatter": "biomejs.biome",
"[javascript][javascriptreact][typescript][typescriptreact][json][css][tailwindcss]": {
"editor.defaultFormatter": "biomejs.biome"
},
// Format on Save
"editor.formatOnSave": true, // must have two key bindings for on-save and non-save
"editor.formatOnPaste": false,
"editor.codeActionsOnSave": {
"source.addMissingImports.ts": "explicit",
"quickfix.biome": "explicit",
"source.organizeImports.biome": "explicit",
"source.fixAll.biome": "explicit"
},
// Support Tailwindcss inside these functions
"tailwindCSS.classFunctions": ["cn", "cva", "cx", "clsx"],
// Replace word when autocompleting (optional)
"editor.suggest.insertMode": "replace",
// convention
"files.insertFinalNewline": true,
// language related
"typescript.validate.enable": true,
"javascript.validate.enable": true,
// set typescript from the node_modules (optional: useful for nextjs projects)
"typescript.tsdk": "node_modules/typescript/lib",
}
Biome v1
{
"$schema": "https://biomejs.dev/schemas/1.0.0/schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
},
"formatter": {
"enabled": true,
"indentStyle": "tab",
"indentWidth": 2,
"lineWidth": 90,
"ignore": ["node_modules", ".next", "dist", ".nuxt", ".wrangler", ".react-email"]
},
"javascript": {
"formatter": {
"arrowParentheses": "always",
"quoteStyle": "double",
"jsxQuoteStyle": "double",
"bracketSameLine": false,
"bracketSpacing": true,
"semicolons": "asNeeded",
"trailingCommas": "none"
}
},
"json": {
"formatter": {
"indentStyle": "tab"
}
},
"linter": {
"enable": true,
"rules": {
"recommended": true,
"correctness": {
"noUnusedImports": "warn",
"noUnusedVariables": "warn",
"noUnsafeOptionalChaining": "error",
"noUnsafeFinally": "error"
},
"nursery": {
"useSortedClasses": {
"level": "warn",
"fix": "safe",
"options": {
"attributes": ["className"],
"functions": ["cn", "clsx", "twMerge"]
}
}
}
}
},
"assist": {
"enabled": true,
"actions": {
"source": {
"organizeImports": "on"
}
}
}
}