-
Notifications
You must be signed in to change notification settings - Fork 1
Migrating precommit hooks from LB #21
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
Migrating precommit hooks from LB #21
Conversation
88622a7 to
7452d19
Compare
- Removed `./examples/pre-commit.nix` in favour of augmenting
`./pre-commit.nix`
- Justification: I'd prefer to keep all the `pre-commit` things in a
single file.
- Added a `flakeModule.rustMonorepoPreCommit` attribute which contains a
module for formatting rust code
- Justification: This copies the API given in
https://github.com/cachix/pre-commit-hooks.nix/blob/7c54e08a689b53c8a1e5d70169f2ec9e2a68ffaf/flake.nix#L27.
My reading of this is that we want to expose a flake module which
enables the rust formatter. @szg251 if we're happy with this, I
can try to get this patched in `pre-commit-hooks.nix` as a more
permanent fix.
- Removed deno precommit hooks
- Justification: originally we rolled our own `deno` precommit
things because the default was slightly broken. But it has now
been patched -- see cachix/git-hooks.nix#377
7452d19 to
87aec9e
Compare
| denoPreCommit = lib.mkOption { | ||
| type = lib.types.flakeModule; | ||
| default = ./pre-commit-hooks/deno.nix; | ||
| readOnly = true; | ||
| description = lib.mdDoc ''pre-commit-hooks.nix hook for Deno in a monorepo setting''; | ||
| example = lib.mdDoc ''TODO(bladyjoker)''; | ||
| }; | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to roll our own deno anymore. They fixed this in the main repo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although this prompts some discussion. In Rust, it seems we want to export a module which does all the formatting -- do we want to provide this feature for all languages (or none)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what you mean...
AFAIK this is about providing Rust formatting with pre-commit-checks.nix, there were reasons why we had to roll our own. @szg251 any comments?
examples/typescript-flake-project-with-extra-dependency/src/MyLib/index.ts
Show resolved
Hide resolved
examples/typescript-flake-project-with-transitive-extra-dependency/src/MyLib/index.ts
Show resolved
Hide resolved
7aab423 to
87aec9e
Compare
bladyjoker
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome thanks
| # ``` | ||
| flakeModule = { | ||
| rustMonorepoPreCommit = lib.mkOption { | ||
| type = lib.types.lazyAttrsOf lib.types.unspecified; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be a flakeModule type if there is such a thing?
| denoPreCommit = lib.mkOption { | ||
| type = lib.types.flakeModule; | ||
| default = ./pre-commit-hooks/deno.nix; | ||
| readOnly = true; | ||
| description = lib.mdDoc ''pre-commit-hooks.nix hook for Deno in a monorepo setting''; | ||
| example = lib.mdDoc ''TODO(bladyjoker)''; | ||
| }; | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what you mean...
AFAIK this is about providing Rust formatting with pre-commit-checks.nix, there were reasons why we had to roll our own. @szg251 any comments?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very lovely, thanks!
Builds off of: #18
Removed
./examples/pre-commit.nixin favour of augmenting./pre-commit.nixpre-committhings in asingle file.
Added a
flakeModule.rustMonorepoPreCommitattribute which contains amodule for formatting rust code
https://github.com/cachix/pre-commit-hooks.nix/blob/7c54e08a689b53c8a1e5d70169f2ec9e2a68ffaf/flake.nix#L27.
My reading of this is that we want to expose a flake module which
enables the rust formatter. @szg251 if we're happy with this, I
can try to get this patched in
pre-commit-hooks.nixas a morepermanent solution.
Removed deno precommit hooks
denoprecommitthings because the default was slightly broken. But it has now
been patched -- see hooks: fix deno fmt/lint configPath cachix/git-hooks.nix#377
Ran precommit hooks for TS