Git commit reported an error

git commit project error

hint:
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:UsersAdministratorAppDataRoamingnpm-cache_logs2018-07-11T09_37_29_235Z-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:UsersAdministratorAppDataRoamingnpm-cache_logs2018-07-11T09_37_29_296Z-debug.log

husky-pre-commit hook failed (add-- no-verify to bypass)

what is the reason for this and how to solve it?
guys, please take a look at it. Thank you ~ ~

npm run lint prompt:

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:UsersAdministratorAppDataRoamingnpm-cache_logs2018-07-11T09_53_08_135Z-debug.log

package.json:

{
"private": true,
"scripts": {
"start": "set PORT=7101 & & roadhog server",
"build": "roadhog build",
"lint": "eslint-- ext .js src test",
"precommit": "npm run lint"
},
"dependencies": {

"antd": "^3.6.3",
"antd-mobile": "^2.1.4",
"classnames": "^2.2.5",
"crypto-js": "^3.1.9-1",
"dva": "^2.1.0",
"moment": "^2.21.0",
"prop-types": "^15.6.0",
"qs": "^6.5.1",
"rc-form": "^2.1.7",
"rc-queue-anim": "^1.5.0",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-images": "^0.5.17",
"react-sticky": "^6.0.1",
"react-zmage": "^0.2.1",
"web-storage-cache": "^1.0.3"},

"devDependencies": {
"antd-mobile-demo-data": "^ 0.2.0",
"babel-plugin-dva-hmr": "^ 0.4.1",
"babel-plugin-import": "^ 1.6.3",
"babel-plugin-transform-decorators-legacy": "^ 1.3.4",
"css-loader": "^ 0.28.9",
"eslint": "^ 4.14.0",
"eslint-config-umi": "^ 0.1.1",
"eslint-plugin-flowtype": "^ 2.34.1",
"eslint-plugin-import": "^ 2.6.0",
"eslint-plugin-jsx-a11y": "^ 5.1.1",
"eslint-plugin-react": "^ 7.1.0",
"husky": "^ 0.12.0",
"less": "^ 2.7.3",
"less-loader": "^ 4.0.5",
"redbox-react": "^ 1.4.3",
"roadhog": "^ 2.0.0",
"style-loader": "^ 0.19.1"
}
}

Mar.25,2021

The reason for this is that the landlord uses husky and configures "precommit": "npm run lint"

.

so it will execute npm run lint that is, eslint-- ext .js src test
if you git commit, it will return non-zero if it reports an error, thus organizing the code commit.

so there are two ways to solve it:

  1. execute npm run lint, to correct the error according to the prompt. If it is someone else's error, ask for assistance (recommended)
  2. git commit-m'- n forced push

execute eslint-- ext .js src test or npm run lint


the code does not conform to the eslint specification


eslint report an error

Menu