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

Chore: Add .pre-commit-hooks.yaml file #13628

merged 4 commits into from Dec 14, 2020

Chore: Add .pre-commit-hooks.yaml file #13628

merged 4 commits into from Dec 14, 2020


Copy link

@mondeja mondeja commented Aug 28, 2020

Prerequisites checklist

What is the purpose of this pull request? (put an "X" next to an item)

[ ] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[x] Other, please explain:

Add .pre-commit-hooks.yaml file to make work Eslint hooks whit pre-commit framework.

This allows users to configure a file in their project named .pre-commit-config.yaml with a content like, for example, this:

  - repo:
    rev: master
      - id: eslint
        name: eslint-webpack-config
        files: webpack
        args: ['-c', 'webpack/.eslintrc.json']
      - id: eslint
        name: eslint-frontend
        files: static/src/js
        args: ['-c', 'static/src/js/.eslintrc.json']

...and every commit that users would attempt in their project will run two hooks to check Javascript files against Eslint. If any of the hooks fails, the commit will be aborted. The interesting part is that only files with changes will be linted.

See markdownlint-cli, flake8 or yamllint as other examples of linters that have been added the file without efforts.

Is there anything you'd like reviewers to focus on?

It's something that doesn't need maintainment, so you wouldn't need focus on.

@eslint-deprecated eslint-deprecated bot added the triage label Aug 28, 2020
@mondeja mondeja changed the title Add .pre-commit-hooks.yaml file New: Add .pre-commit-hooks.yaml file Aug 28, 2020
@kaicataldo kaicataldo added enhancement evaluating and removed triage labels Aug 29, 2020
Copy link

kaicataldo commented Sep 12, 2020

I'm not against adding this if it doesn't require any additional maintenance, though it feels like an inverse of responsibilities to me to put the onus on the other projects to include this definition rather than the project that will be consuming it.

Copy link
Contributor Author

mondeja commented Sep 12, 2020

I understand you, close the pull if you don't feel comfortable with the file. It's only useful for the programmers that want to use the master of eslint in their hooks, but we can always settle for the mirror that uses pre-commit.

@nzakas nzakas changed the title New: Add .pre-commit-hooks.yaml file Chore: Add .pre-commit-hooks.yaml file Oct 7, 2020
nzakas approved these changes Oct 7, 2020
Copy link

@nzakas nzakas left a comment

Seems like a small enough change without any overhead, so okay by me.

Copy link

kaicataldo commented Oct 10, 2020

Do we need to include this file in the published package on npm, or does this check the repo somehow?

Copy link
Contributor Author

mondeja commented Oct 10, 2020

Only checks the repo, pre-commit clones repos to prepare environments for hooks.

nzakas approved these changes Dec 14, 2020
@nzakas nzakas merged commit dc76911 into eslint:master Dec 14, 2020
12 checks passed
sthagen added a commit to sthagen/eslint-eslint that referenced this issue Dec 17, 2020
Chore: Add .pre-commit-hooks.yaml file (eslint#13628)
@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators Jun 13, 2021
@eslint-github-bot eslint-github-bot bot added the archived due to age label Jun 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
archived due to age enhancement evaluating
None yet

Successfully merging this pull request may close these issues.

None yet

4 participants