Biome
Biome 是一个快速的一体化代码格式化、lint 工具,旨在替代 ESLint 和 Prettier 的组合。它使用 Rust 编写,具有极快的性能。
安装
npm install --save-dev @biomejs/biome
配置文件
在项目根目录创建 biome.json 文件:
{
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"style": {
"noNonNullAssertion": "error",
"useTemplate": "error"
},
"suspicious": {
"noExplicitAny": "error",
"noConsoleLog": "warn"
},
"correctness": {
"noUnusedVariables": "error",
"useExhaustiveDependencies": "error"
}
}
},
"formatter": {
"enabled": true,
"formatWithErrors": false,
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 80,
"lineEnding": "lf",
"ignore": [
"node_modules/**",
"dist/**",
"build/**"
]
},
"javascript": {
"formatter": {
"quoteStyle": "single",
"trailingComma": "all",
"semicolons": "always"
}
}
}