Skip to content

Commit

Permalink
chore: make prettier/pre-commit much faster (#4036)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx authored Jan 10, 2025
1 parent c2accc5 commit cf07782
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
11 changes: 11 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
*.rs
*.snap
.idea
.venv
*.gif
*.png
*.lock
*.lockb
.cliffignore
*.kdl
CHANGELOG.md
aqua-registry/
docs/.vitepress/cache
Expand All @@ -7,7 +16,9 @@ docs/cli
docs/environments.md
docs/public/site.webmanifest
docs/registry.md
e2e
src/assets/bash_zsh_support/
tasks.md
test/data
tmp
xtasks/fig/src/mise.ts
1 change: 1 addition & 0 deletions src/cli/generate/git_pre_commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ impl GitPreCommit {
r#"#!/bin/sh
STAGED="$(git diff-index --cached --name-only HEAD | tr ' ' '\ ' | tr '\n' ' ' | xargs)"
export STAGED
export MISE_PRE_COMMIT=1
exec mise run {task}
"#
)
Expand Down
10 changes: 0 additions & 10 deletions tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,18 +131,8 @@ User to run as

## `pre-commit`

- Depends: pre-commit:*

- **Usage**: `pre-commit`

## `pre-commit:check`

- **Usage**: `pre-commit:check`

## `pre-commit:fmt`

- **Usage**: `pre-commit:fmt`

## `release`

- **Usage**: `release`
Expand Down
7 changes: 2 additions & 5 deletions tasks.toml
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,5 @@ run = "echo {{arg(name='greeting')}}; sleep 2; echo 2; sleep 2; echo 3; sleep 0.
description = "a task for testing"

[pre-commit]
depends = ["pre-commit:*"]
["pre-commit:fmt"]
run = "cargo fmt --all -- --check"
["pre-commit:check"]
run = "cargo check -q --all-features"
env = { PRE_COMMIT = 1 }
run = ["mise run lint"]
6 changes: 5 additions & 1 deletion xtasks/lint/clippy
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@
#MISE wait_for=["build"]
set -euo pipefail

cargo clippy --all-features -- -Dwarnings
if [[ "${MISE_PRE_COMMIT:-}" == 1 ]]; then
cargo check -q --all-features
else
cargo clippy --all-features -- -Dwarnings
fi
5 changes: 1 addition & 4 deletions xtasks/lint/prettier
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@
#MISE wait_for=["render:settings"]
set -euo pipefail

# shellcheck disable=SC2046

prettier -c $(git ls-files '*.yml' '*.yaml')
prettier -c .
prettier --cache --ignore-unknown --log-level warn -c "$@" .

0 comments on commit cf07782

Please sign in to comment.