Skip to content
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
1 change: 0 additions & 1 deletion .github/config/super-linter.env
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ VALIDATE_JSONC=true
VALIDATE_MARKDOWN=true
VALIDATE_MARKDOWN_PRETTIER=true
VALIDATE_NATURAL_LANGUAGE=true
VALIDATE_PYTHON_ISORT=true
VALIDATE_PYTHON_RUFF=true
VALIDATE_PYTHON_RUFF_FORMAT=true
VALIDATE_SHELL_SHFMT=true
Expand Down
8 changes: 8 additions & 0 deletions .textlintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"filters": {
"comments": true
},
"rules": {
"terminology": true
}
}
13 changes: 7 additions & 6 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ This ensures all files pass CI linting (Biome formatting,
shellcheck, etc.). Review the auto-fixed files before
committing — auto-fixes may produce unexpected results.

A pre-commit hook can automate this — run
`mise run setup:pre-commit-hook` once per clone to install
it. The hook runs native linters with autofix on every
commit.
Linting can be automated via a Git pre-commit hook or an
agent-specific hook (e.g. a Claude Code `PreToolUse` hook
that intercepts `git push`). Use whichever fits your
workflow — both are optional. To install the Git hook:

```bash
# Auto-fix and verify (recommended dev workflow)
Expand All @@ -120,7 +120,7 @@ mise run fix
# Verify only (same command used in CI)
mise run lint

# Install pre-commit hook (one-time setup)
# Install git pre-commit hook (one-time, opt-in)
mise run setup:pre-commit-hook
```

Expand All @@ -145,9 +145,10 @@ standard locations (project root), not in
`.github/linters/` (super-linter's convention). The
script errors if `.github/linters/` exists. All
supported linters auto-discover their config:
`textlint`→`.textlintrc`,
`shellcheck`→`.shellcheckrc`,
`markdownlint`→`.markdownlint.json`,
`editorconfig-checker`→`.ecrc`,
`ec` (editorconfig-checker)→`.ecrc`,
`actionlint`→`.github/actionlint.yml`,
`hadolint`→`.hadolint.yaml`,
`golangci-lint`→`.golangci.yml`,
Expand Down
5 changes: 0 additions & 5 deletions mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ SUPER_LINTER_VERSION="slim-v8.5.0@sha256:857dcc3f0bf5dd065fdeed1ace63394bb200423
description = "Run Super-Linter on the repository"
file = "tasks/lint/super-linter.sh"

[tasks."lint:super-linter-native"]
description = "Run linters natively (fast, for local dev)"
depends = ["setup:native-lint-tools"]
run = [{ task = "lint:super-linter", env = { NATIVE = "true" } }]

[tasks."setup:native-lint-tools"]
description = "Install native lint tools matching the pinned super-linter version"
file = "tasks/setup/native-lint-tools.sh"
Expand Down
2 changes: 2 additions & 0 deletions super-linter-versions/v8.4.0.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ hadolint = "v2.14.0"
"npm:markdownlint-cli" = "0.47.0"
"npm:prettier" = "3.8.1"
"npm:@biomejs/biome" = "2.3.13"
"npm:textlint" = "15.5.1"
"npm:textlint-rule-terminology" = "5.2.16"
"pipx:ruff" = "0.14.14"
"pipx:codespell" = "2.4.1"
editorconfig-checker = "v3.6.0"
Expand Down
2 changes: 2 additions & 0 deletions super-linter-versions/v8.5.0.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ hadolint = "v2.14.0"
"npm:markdownlint-cli" = "0.47.0"
"npm:prettier" = "3.8.1"
"npm:@biomejs/biome" = "2.3.14"
"npm:textlint" = "15.5.1"
"npm:textlint-rule-terminology" = "5.2.16"
"pipx:ruff" = "0.15.0"
"pipx:codespell" = "2.4.1"
editorconfig-checker = "v3.6.1"
Expand Down
27 changes: 21 additions & 6 deletions tasks/lint/super-linter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,29 @@ ENV_FILE="${SUPER_LINTER_ENV_FILE:-.github/config/super-linter.env}"

# --- Native mode ---
if [ "$NATIVE" = "true" ]; then
# Activate the mise environment created by setup:native-lint-tools so that
# installed tools (shfmt, actionlint, codespell, etc.) are on PATH.
# Activate the mise environment so installed tools are on PATH.
# The .mise.super-linter-*.toml is created by setup:native-lint-tools.
# In worktrees it won't exist — create it from the tracked version mapping.
_SL_ENV_TOML=$(compgen -G ".mise.super-linter-*.toml" | head -1 || true)
if [ -z "$_SL_ENV_TOML" ] && [ -n "${SUPER_LINTER_VERSION:-}" ]; then
_SL_TAG="${SUPER_LINTER_VERSION#slim-}"
_SL_TAG="${_SL_TAG%%@*}"
_SL_VERSION_TOML="super-linter-versions/${_SL_TAG}.toml"
if [ -f "$_SL_VERSION_TOML" ]; then
_SL_ENV_TOML=".mise.super-linter-${_SL_TAG}.toml"
cp "$_SL_VERSION_TOML" "$_SL_ENV_TOML"
mise trust "$_SL_ENV_TOML"
fi
Comment thread
zeitlinger marked this conversation as resolved.
fi
if [ -n "$_SL_ENV_TOML" ]; then
_SL_ENV_NAME="${_SL_ENV_TOML#.mise.}"
_SL_ENV_NAME="${_SL_ENV_NAME%.toml}"
# Allow failure so the script falls through to the "Missing native lint tools"
# message instead of exiting with a confusing mise error.
eval "$(mise env -E "$_SL_ENV_NAME" 2>/dev/null)" || true
_SL_ENV_OUTPUT=$(mise env -E "$_SL_ENV_NAME") || {
echo "Error: failed to activate mise environment '$_SL_ENV_NAME'." >&2
echo "Run 'mise run setup:native-lint-tools' to install tools." >&2
exit 1
}
eval "$_SL_ENV_OUTPUT"
fi

# Native mode expects linter configs at the project root (standard tool locations).
Expand Down Expand Up @@ -168,12 +182,13 @@ if [ "$NATIVE" = "true" ]; then
"VALIDATE_MARKDOWN_PRETTIER|prettier|prettier --check {FILE}|prettier --write {FILE}|*.md"
"VALIDATE_YAML_PRETTIER|prettier|prettier --check {FILE}|prettier --write {FILE}|*.yaml *.yml"
"VALIDATE_JSON_PRETTIER|prettier|prettier --check {FILE}|prettier --write {FILE}|*.json"
"VALIDATE_EDITORCONFIG|editorconfig-checker|editorconfig-checker {FILES}||*"
"VALIDATE_EDITORCONFIG|ec|ec {FILES}||*"
"VALIDATE_GITHUB_ACTIONS|actionlint|actionlint {FILE}||.github/workflows/*.yml .github/workflows/*.yaml"
"VALIDATE_DOCKERFILE_HADOLINT|hadolint|hadolint {FILE}||Dockerfile Dockerfile.* *.dockerfile"
"VALIDATE_GO_GOLANGCI_LINT|golangci-lint|golangci-lint run||SELF"
"VALIDATE_PYTHON_RUFF|ruff|ruff check {FILE}|ruff check --fix {FILE}|*.py"
"VALIDATE_PYTHON_RUFF_FORMAT|ruff|ruff format --check {FILE}|ruff format {FILE}|*.py"
"VALIDATE_NATURAL_LANGUAGE|textlint|textlint {FILE}||*.md *.txt"
"VALIDATE_SPELL_CODESPELL|codespell|codespell {FILES}|codespell --write-changes {FILES}|*"
"VALIDATE_JSONC|biome|biome check {FILE}|biome check --fix {FILE}|*.json *.jsonc *.js *.ts *.jsx *.tsx"
"VALIDATE_BIOME_FORMAT|biome|biome format {FILE}|biome format --write {FILE}|*.json *.jsonc *.js *.ts *.jsx *.tsx"
Expand Down
4 changes: 4 additions & 0 deletions tasks/setup/update-super-linter-versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ golangci_lint=$(_from_version "golangci/golangci-lint")
markdownlint=$(_npm_version "markdownlint-cli")
prettier=$(_npm_version "prettier")
biome=$(_npm_version "@biomejs/biome")
textlint=$(_npm_version "textlint")
textlint_terminology=$(_npm_version "textlint-rule-terminology")
ruff=$(_pip_version "ruff")
codespell=$(_pip_version "codespell")

Expand All @@ -83,6 +85,8 @@ hadolint = "${hadolint}"
"npm:markdownlint-cli" = "${markdownlint}"
"npm:prettier" = "${prettier}"
"npm:@biomejs/biome" = "${biome}"
"npm:textlint" = "${textlint}"
"npm:textlint-rule-terminology" = "${textlint_terminology}"
"pipx:ruff" = "${ruff}"
"pipx:codespell" = "${codespell}"
editorconfig-checker = "${editorconfig_checker}"
Expand Down
Loading