前言

简单讲一下需要使用到的一些工具库

husky

https://github.com/typicode/husky

Modern native git hooks made easy

Husky improves your commits and more 🐶 woof!

也就是说,husky为我们提供了一系列的git hooks,用于在进行git操作时的一些预处理等等

lint-staged

https://github.com/lint-staged/lint-staged

Run linters against staged git files and don't let 💩 slip into your code base!

专门用于在通过 git 提交代码之前,对暂存区的代码执行一系列的格式化

Biome

个人也非常推荐

不是很喜欢 eslint + prettier 那一套,麻烦,而且要装一堆插件

Biome

One toolchain for your web project

通过一个工具就可以完成包括 format、lint等等的工具链(速度也非常快,内部使用rust编写的)

顺便说一下,之前 prettier 也发起了一个 rust化的竞赛,biome也获得了最终的奖金🎉🎉🎉

Biome formatter wins the Prettier challenge | Biome (biomejs.dev)