鍍金池/ 問答/Linux  HTML/ react項目,配置esLint,git commit報錯

react項目,配置esLint,git commit報錯

報錯:
? 1127 problems (1123 errors, 4 warnings)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ lint: eslint --ext .js src test
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:UsersQiHuaBuAppDataRoamingnpm-cache_logs2018-01-25T03_46_52_488Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ precommit: npm run lint
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ precommit script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:UsersQiHuaBuAppDataRoamingnpm-cache_logs2018-01-25T03_46_52_552Z-debug.log
husky - pre-commit hook failed (add --no-verify to bypass)

clipboard.png

clipboard.png

clipboard.png

.eslint文件:
{

"parser": "babel-eslint",
"extends": "airbnb",
"rules": {
 //"linebreak-style":[0],
    "arrow-body-style": [0],
    "consistent-return": [0],
    "generator-star-spacing": [0],
    "global-require": [1],
    "import/extensions": [0],
    "import/no-extraneous-dependencies": [0],
    "import/no-unresolved": [0],
    "import/prefer-default-export": [0],
    "jsx-a11y/no-static-element-interactions": [0],
    "no-bitwise": [0],
    "no-cond-assign": [0],
    "no-else-return": [0],
    "no-nested-ternary": [0],
    "no-restricted-syntax": [0],
    "no-use-before-define": [0],
    "react/forbid-prop-types": [0],
    "react/jsx-filename-extension": [1, {
        "extensions": [".js"]
    }],
    "react/jsx-no-bind": [0],
    "react/prefer-stateless-function": [0],
    "react/prop-types": [0],
    "require-yield": [1]
},
"parserOptions": {
    "ecmaFeatures": {
        "experimentalObjectRestSpread": true
    }
}

}

clipboard.png

剛接觸react、eslint!查了好久資料,還是改不了。
老鐵們,幫忙看看>_<

回答
編輯回答
心悲涼

看你的eslint報錯很明顯,基本都是縮進和空白符問題,空白符的問題在mac和window表現(xiàn)不一樣,你的eslint的配置文件還是根據(jù)自己的習慣或者公司的規(guī)定來添加吧,別使用擴展的airbnb,只是選擇你需要的規(guī)則,airbnb的一套那么多,不一定都合適你自己,可以看看我的文章eslint使用

2018年1月16日 05:36