文章出處
文章列表
1. 全局安裝eslint
npm install -g eslint
npm install -g eslint-config-airbnb eslint-plugin-import eslint-plugin-react eslint-plugin-jsx-a11y babel-eslint
2.在項目目錄下新建.eslintrc文件
添加內容
{
"extends": "airbnb",
"parser": "babel-eslint",
"env": {
"browser": true,
"node": true,
"mocha": true
},
"globals": {
"Babel": true,
"React": true
},
"plugins": [
"react"
],
"rules": {
"global-require": "off",
"import/no-unresolved": "off",
"no-underscore-dangle": "off",
"no-new-func": "off",
"no-param-reassign": "off",
"react/prefer-stateless-function": "off",
"react/no-multi-comp": "off",
"react/jsx-no-bind": "off",
"react/jsx-indent": "off",
"react/jsx-first-prop-new-line": "off",
"react/jsx-filename-extension": "off",
"no-restricted-syntax": "off"
}
}
3. 編輯器配置linter
vscode
F1->install Extensions,選擇 ESLint 即可
sublime text3
install pacakge,選擇 SublimeLinter
install pacakge,選擇 SublimeLinter-contrib-eslint
SublimeLinter: Enable Linter
文章列表
全站熱搜
留言列表