NoteDeep
就像phpMD一样。

Lint 的含义

在公司中每个人写出的代码都要符合一个统一的规则,这样别人看源码就能够看得懂,因为源码是符合统一的编码规范制定的。
这个工具应该做两件事情:
  • 提供编码规范;
  • 提供自动检验代码的程序,并打印检验结果:告诉你哪一个文件哪一行代码不符合哪一条编码规范,方便你去修改代码。
Lint 因此而诞生。

Eslint 的含义

Lint 是检验代码格式工具的一个统称,具体的工具有 JslintEslint 等等





$ npm install eslint --save-dev
你应该设置一个配置文件:
$ ./node_modules/.bin/eslint --init
之后,您可以运行ESLint在任何文件或目录如下:
$ ./node_modules/.bin/eslint yourfile.js


babel-eslint是什么?

babel-eslint allows you to lint ALL valid Babel code

Why Use babel-eslint

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

extends: 'fbjs',
fbjseslint-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之后就好了。




评论列表

    Lint 的含义
    Eslint 的含义
    babel-eslint是什么?
    Why Use babel-eslint