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: make prettier/pre-commit much faster #4036

Merged
merged 2 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 "$@" .
Loading