Webpack 与 Vite 对比
前端构建工具的两代产品:根基深厚、功能强大的 Webpack 与彻底革新开发体验的 Vite。你的项目应该选择哪种构建工具?
JavaScript linting标准
高速一体化工具链
| 分类 | ESLint | Biome |
|---|---|---|
| 性能 | 6/10 | 10/10 |
| 学习难易度 | 7/10 | 9/10 |
| 生态系统 | 10/10 | 5/10 |
| 社区 | 10/10 | 5/10 |
| 就业市场 | 10/10 | 4/10 |
| 面向未来 | 7/10 | 9/10 |
// eslint.config.js (ESLint 9 flat config)
import js from '@eslint/js';
import typescript from '@typescript-eslint/eslint-plugin';
import tsParser from '@typescript-eslint/parser';
import reactHooks from 'eslint-plugin-react-hooks';
export default [
js.configs.recommended,
{
files: ['**/*.{ts,tsx}'],
languageOptions: {
parser: tsParser,
parserOptions: { project: './tsconfig.json' }
},
plugins: {
'@typescript-eslint': typescript,
'react-hooks': reactHooks
},
rules: {
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-unused-vars': 'error',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn'
}
}
];// biome.json —— lint + format 配置
{
"$schema": "https://biomejs.dev/schemas/1.8.0/schema.json",
"organizeImports": { "enabled": true },
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"correctness": { "noUnusedVariables": "error" },
"suspicious": { "noExplicitAny": "error" },
"style": { "useConst": "warn" }
}
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 100
},
"javascript": {
"formatter": { "quoteStyle": "single", "trailingCommas": "es5" }
}
}对新项目而言,Biome零配置的速度优势极具吸引力;但对于依赖大量自定义ESLint规则的大型生态系统来说,ESLint依然不可或缺。同时使用两者(Biome负责格式化,ESLint负责检查)的做法也越来越普遍。
获取免费咨询Biome的格式化器与Prettier兼容度达97%,且速度快得多。从Prettier迁移到Biome通常很顺利;若有细微的输出差异,可通过biome format --write自动修正。