AlloyTeam / eslint-config-alloy

Progressive ESLint config for your React/Vue/TypeScript projects
https://alloyteam.github.io/eslint-config-alloy/
2.65k stars 317 forks source link

no-undef 规则默认关闭的原因是什么? #259

Open xqyi opened 7 months ago

xqyi commented 7 months ago

在使用中发现 no-undef 规则默认是关闭的,我知道这个规则和 typescript 已有的语法检查有重复,但是如果出现使用了未定义变量的情况,尽管 typescript 能检测到,但并不强行要求修正,在向 git 提交代码时会将此问题提交到代码服务器上,开启 no-undef 规则可以借助 husky 和 lint-staged 很好的阻止这个错误提交到代码服务器上,Alloy 出于什么考虑关闭该规则呢?

GoodbyeNJN commented 7 months ago

241

https://typescript-eslint.io/linting/troubleshooting/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors