eslint是一個被普遍應用的javascript/jsx代碼檢查工具。javascript
eslint配置文件可使用js/yaml/json格式,或者在package.json中添加"eslintConfig"選項。.eslintrc已被廢棄。js格式更爲靈活,react項目用的是js後綴,即.eslintrc.js。java
extends
是指擴展eslint官方支持的lint規則react
extends: 'fbjs',
fbjs
是eslint-config-fbjs
和簡寫,對應npm模塊eslint-config-fbjs。從這個配置中,咱們能夠看到react沒有使用eslint默認的解析器Espree
,而是選擇了babel-eslint
。爲何呢?看babel-eslint
官方介紹,當且僅當你使用了強類型如(Flow)或者一些eslint不支持的仍處於實驗階段的js特性時,你才須要使用babel-eslint
。git
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)github
plugins
是指經過自定義插件,擴展可用的lint規則。好比eslint-react插件,就自定義了跟jsx語法相關的lint規則。npm
plugins: [ 'react', 'react-internal', ],
上面的react
是eslint-plugin-react
的簡稱。react-internal
是eslint-plugin-react-internal
的簡稱。json
原文:https://github.com/liushuigs/react-source-learning/blob/master/root/what-is-eslint.mdbabel