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!查了好久资料,还是改不了。
老铁们,帮忙看看>_<

阅读 5.3k
1 个回答

看你的eslint报错很明显,基本都是缩进和空白符问题,空白符的问题在mac和window表现不一样,你的eslint的配置文件还是根据自己的习惯或者公司的规定来添加吧,别使用扩展的airbnb,只是选择你需要的规则,airbnb的一套那么多,不一定都合适你自己,可以看看我的文章eslint使用

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏