在公司中每个人写出的代码都要符合一个统一的规则,这样别人看源码就能够看得懂,因为源码是符合统一的编码规范制定的。
Lint 是检验代码格式工具的一个统称,具体的工具有 Jslint 、 Eslint 等等
In case some has the same thing: it seems when using yarn workspaces eslint binary might run against a different babel-eslint than the one defined in your package. Yuck.
$ npm install eslint --save-dev
$ ./node_modules/.bin/eslint --init
之后,您可以运行ESLint在任何文件或目录如下:
$ ./node_modules/.bin/eslint yourfile.js
babel-eslint allows you to lint ALL valid Babel code
You only need to use babel-eslint if you are using types (Flow) or experimental features not supported in ESLint itself yet. Otherwise try the default parser (you don't have to use it just because you are using Babel).
flow code =》 用 babel-eslint 检测
normal code => 用 eslint 检测
flow code -> babel-preset-flow插件 -> normal code
fbjs是eslint-config-fbjs和简写,对应npm模块eslint-config-fbjs。
https://segmentfault.com/a/1190000008943134
在draftJs源码下执行eslint时遇到的一个问题,虽然目前不清楚原因。
https://github.com/facebook/draft-js/pull/1882
但是把babel-eslint升级到^9.0.0之后就好了。