eslist 几种规则区别

3,516 阅读1分钟

Pick a linter / formatter config: (Use arrow keys)
> ESLint with error prevention only
  ESLint + Airbnb config
  ESLint + Standard config
  ESLint + Prettier

ESLint with error prevention only(只是错误而已)
ESLint + Airbnb config(名字规范)
ESLint + Standard config(标准规范
  • 选择什么时候进行代码规则检测:
  • 建议选保存就检测,等到commit的时候,问题可能都已经积累很多了
  • 之前写了篇VsCode保存时自动修复Eslint错误推荐一下。
? Pick additional lint features: (Press <space> to select, to toggle all, to invert selection)

( ) Lint on save // 保存就检测
( ) Lint and fix on commit // fix和commit时候检查

zhuanlan.zhihu.com/p/79561192

segmentfault.com/a/119000001…

重要屏蔽 规则

"no-console": "off",
"no-unused-vars":"off",
'eqeqeq': ["off"],
    

项目实践 目前有三个流行方案,分别是 Airbnb 、Standard、Google,严格程度对比是 Airbnb > Google > Standard,所以普遍使用Airbnb的多。

juejin.cn/post/684490…

Airbnb 、Standard、Google 三个地址

github.com/google/esli…

standardjs.com/readme-zhcn…

github.com/airbnb/java…