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
merged 4 commits into from Dec 14, 2020
Merged

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

merged 4 commits into from Dec 14, 2020

Conversation

mondeja
Copy link
Contributor

@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:

repos:
  - repo: https://github.com/eslint/eslint
    rev: master
    hooks:
      - 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 An ESLint team member will look at this issue soon 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 This change enhances an existing feature of ESLint evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion and removed triage An ESLint team member will look at this issue soon labels Aug 29, 2020
@kaicataldo
Copy link
Member

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.

@mondeja
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
Copy link
Member

@nzakas nzakas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@kaicataldo
Copy link
Member

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

@mondeja
Copy link
Contributor Author

mondeja commented Oct 10, 2020

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

@nzakas nzakas merged commit dc76911 into eslint:master Dec 14, 2020
@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 This issue has been archived; please open a new issue for any further discussion label Jun 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion enhancement This change enhances an existing feature of ESLint evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants