Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Prevent pre-commit hook to continue on committing? #149

Open
diegodesouza opened this issue Apr 20, 2020 · 5 comments
Open

Question: Prevent pre-commit hook to continue on committing? #149

diegodesouza opened this issue Apr 20, 2020 · 5 comments

Comments

@diegodesouza
Copy link

I'm trying to prevent git/vim from opening when there's a lint warning/error.

  "scripts": {
   ...
    "lint": "av lint",
   ...
  },
  "pre-commit": ["lint"],

Right now, when running git commit the pre-commit hook will run the lint, and even though there are lint errors, it won't prevent the developer from committing the work. Can you suggest a solution?

@diegodesouza
Copy link
Author

@3rd-Eden @mcollina @kriskowal @alexindigo would you have a suggestion?

@mcollina
Copy link
Contributor

I don't know what library are you using, but it's not exiting with exit code 1.

@diegodesouza
Copy link
Author

{
...
  "scripts": {
    ...
    "lint": "lint",
    ...
  },
  "pre-commit": [
    "lint"
  ],
  ...

  "dependencies": {
    ...
    "prop-types": "^15.7.2",
    "react": "^16.13.1",
    "react-block-ui": "^1.3.3",
    "react-dom": "^16.13.1",
    "react-dropzone": "7.0.1",
    "react-hot-loader": "^4.12.20",
    "react-hot-loader-loader": "0.0.7",
    "react-html-parser": "^2.0.2",
    "react-input-mask": "^2.0.4",
    "react-router-dom": "^5.1.2",
    "reactstrap": "^8.0.0",
    "save": "^2.4.0",
    "tus-js-client": "^1.8.0",
    "uuid": "^7.0.3"
  },
  "devDependencies": {
   ...
    "chai": "^4.2.0",
    "cross-env": "^5.0.5",
    "enzyme": "^3.11.0",
    "husky": "^4.2.5",
    "lint-staged": "^10.1.6",
    "moxios": "^0.4.0",
    "pre-commit": "^1.2.2",
    "prettier": "^1.19.1",
    "react-test-renderer": "^16.13.1",
    "sinon": "^7.3.2",
    "sinon-chai": "^3.5.0"
  }
}

@diegodesouza
Copy link
Author

@mcollina my fault there's my package.json

@diegodesouza
Copy link
Author

I have also tried --bailOnLintError true without avail

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants