-
-
Notifications
You must be signed in to change notification settings - Fork 131
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
add .pre-commit-hooks.yaml
for those using this tool
#227
Comments
Hey @CircleOnCircles! 👋 When you say "it is missing", do you mean:
|
More like this one. There are 2 jobs
|
Thanks for the clarification:
|
Thanks for your advice. I will try to do a PR soon. I come from a Python domain, thus pre-commit seems more appealing to me. |
I’m all open to new integrations. Typically, they can be maintained on their own, outside of this project. In this case, as that’s a Python project and I don’t speak Python, it doesn’t sit too well with me to maintainer it here. A couple of other integrations are listed here in the readme: https://github.com/remarkjs/remark-lint#integrations So, if someone wants to add this, that’s welcome! |
pre-commit is a general purpose linting framework that happens to be written in Python. It supports a host of different languages. With pre-commit.ci, there is quite a nice online tool for running the checks and updates. It's ideal if the pre-commit-hooks.yaml (which is a very small, simple file) can be in the main repository, because pre-commit caches on the revision. It has been done in a few special cases, but it either requires manually or automatically syncing tags on releases. Dropping this file into the main repo is much easier to maintain. However, on quick testing, it seems the "package.json" is missing the name/version, which are required by Setting this up as a local hook works, but it seems that "warnings" do not trigger a "failing" exit code, so pre-commit thinks the hooks pass. Here's my local config: - repo: local
hooks:
- id: remarklint
name: remarklint
language: node
entry: remark
types: [markdown]
args: ["-u", "preset-lint-recommended"]
verbose: true # Necessary to see if this is working at all since this always "passes"
additional_dependencies: [remark, remark-lint, remark-cli, remark-preset-lint-recommended] PS: changing checks are even better, but I wasn't sure how to run the changing one from the CLI. |
You can pass |
Thanks! I have this now: - repo: local
hooks:
- id: remarklint
name: remarklint
language: node
entry: remark
types: [markdown]
args: ["--frail", "--quiet"]
additional_dependencies: [remark, remark-lint, remark-cli, remark-preset-lint-recommended, remark-lint-list-item-indent] This works pretty well, though admittedly, I don't understand why I have to explicitly list To make this easier, a little repo could be made with a hook file with more-or-less the contents above, though it probably should be a node hook and the dependencies specified through package.json (so users could add ones they needed, like preset-lint-recommended or remark-lint-list-item-indent without having to specify remark and such over again). Also the versions should be pinned (at least remark-lint). Would you be interested in keeping something like that in this org? It would need version bumps, but that should be the only maintenance needed. |
PS: the benefit, other than making it easier for pre-commit users to add this, and being able to be listed on https://pre-commit.com/hooks.html, would be that pre-commit.ci and |
I'm not against
|
Well, a first step might be just showing the example I have above somewhere, it does work, though it would be nice to offer an actual integration.
I've played with setting this up, but ran into a node issue. What I'd like is to have a package.json file like this: {
"name": "required-but-not-used",
"version": "0.0.0",
"dependencies": {
"remark-lint": "8.0.0",
"remark": "*",
"remark-cli": "*"
}, And then be able to access npm install --dev --prod --ignore-prepublish --no-progress --no-save
npm pack <prefix> # produces name of pkg
npm install -g <pkg> Would you happen to know how I can add a requirement to package.json and then "export" a script from it to be used? I've tried a few things like |
Because git hooks themselves aren't terribly complex, each language ecosystem adds abstractions around hooks tuned for that language's own tools to add value above and beyond plain hooks.
It's true that any of the above could be used with any other language, and it's perfectly fine to do so.
Thoughts on this @remarkjs/core and @remarkjs/maintainers?
👍
👍
* except for this script and setting up Python
Thanks! 🙇
|
pre-commit is a linter runner, more than just a githooks framework (which it also is - but you don't need to run
Well, Thanks for the pointers, I'll tinker on this and get back to you. |
shell is a lint runner too 😉 🙂
Agreed, and that's part of its niche. Many languages have comprehensive, integrated, and opinionated package management and script/test/lint runners.
I don't know why you are taking this as a personal affront. There are also other wonderful tools, the tools listed above #227 (comment), not to mention SonarQube, and host of other code quality tools. |
Came looking for this integration specifically. Without it, I'll probably just fall back to prettier. I wouldn't say it's critical, but markdown is annoying enough to deal with without having to deal with linter compatibility. This is personal preference, of course. |
@muppetjones it helps to read discussion before commenting. 🙂 If you want to get started quickly: - repo: local
hooks:
- id: remarklint
name: remarklint
language: node
entry: remark
types: [markdown]
args: ["--frail", "--quiet"]
additional_dependencies: [remark, remark-lint, remark-cli, remark-preset-lint-recommended] If you'd like to build a mirror with something more specific/custom, feel free to https://github.com/pre-commit/pre-commit-mirror-maker and that can be shared back with the community an integration linked in the documentation. I'm locking this issue as this is not a planned code change in this repo, and the issue tracker is a place to track changes for this repository specific, rather than questions or discussions. If folks have questions on using remark-lint the Q&A discussion board is open. https://github.com/orgs/remarkjs/discussions |
https://pre-commit.com/hooks.html is missing this cool tool. 😞
Can we add the
.pre-commit-hooks.yaml
?The text was updated successfully, but these errors were encountered: