From 511569458e7f54ce91c890a74cf198fa7634c6ec Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Fri, 13 Mar 2026 11:19:44 +0000 Subject: [PATCH 1/4] feat: support NATIVE env var for container-free linting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The --native flag on lint:super-linter can now also be set via NATIVE=true env var, mirroring how AUTOFIX=true already works. This allows the top-level lint meta-task (which uses depends) to propagate native mode — mise's depends can't forward CLI flags but env vars flow through naturally. Adds a native-lint task and modernizes lint:super-linter-native and pre-commit to use structured run syntax where applicable. Signed-off-by: Gregor Zeitlinger --- README.md | 46 +++++++++++++++++++++++++++++--------- mise.toml | 10 ++++++--- tasks/lint/super-linter.sh | 5 ++++- 3 files changed, 46 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index e1a28df..1456414 100644 --- a/README.md +++ b/README.md @@ -101,6 +101,10 @@ depends = ["lint:super-linter", "lint:links", "lint:renovate-deps"] [tasks.fix] description = "Auto-fix lint issues and regenerate tracked deps" run = "AUTOFIX=true mise run lint" + +[tasks.native-lint] +description = "Run lints natively (no container)" +run = "NATIVE=true mise run lint" ``` Finally, extend the flint [Renovate preset](#automatic-version-updates-with-renovate) @@ -160,6 +164,11 @@ Docker versioning). | `--native` | Run linters natively instead of via container | | `--full` | Lint all files instead of only changed files | +`--autofix` and `--native` can also be set via the `AUTOFIX=true` +and `NATIVE=true` environment variables respectively. This is how +the `fix` and `native-lint` meta-tasks propagate them through the +`depends` chain. + When autofix is not enabled, all `FIX_*` lines are filtered out of the env file before running Super-Linter. @@ -405,11 +414,13 @@ committed `.github/renovate-tracked-deps.json`: scans, the linter will detect the change and require regeneration. -## How AUTOFIX Works +## How AUTOFIX and NATIVE Work -Lint scripts that support fixing accept an `--autofix` flag. Autofix -can also be enabled via the `AUTOFIX=true` environment variable, which -is how the `fix` meta-task propagates it through the dependency chain. +Lint scripts accept `--autofix` and `--native` flags. Both can also be +set as environment variables (`AUTOFIX=true`, `NATIVE=true`), which is +how the `fix` and `native-lint` meta-tasks propagate them through the +`depends` chain — mise's `depends` cannot forward CLI flags, but env +vars flow through naturally. **Check mode** (default): @@ -431,27 +442,40 @@ mise run lint:renovate-deps --autofix # Regenerate tracked deps Linters that don't support autofix (like lychee link checker) silently ignore the `AUTOFIX` environment variable. +**Native mode:** + +```bash +mise run native-lint # All lints, natively (no container) +# Or run directly: +NATIVE=true mise run lint # Same effect +mise run lint:super-linter -- --native # Single task with CLI flag +``` + +Native mode is useful in environments where Docker/Podman is +unavailable (e.g., inside containers, CI hooks). Tasks that don't +use a container (like `lint:links`) ignore the `NATIVE` variable. + ## Pre-commit hook -Flint provides a `pre-commit` task that runs native linters with -autofix on every commit — fast feedback without the container -overhead. To set it up: +Flint provides a `pre-commit` task that runs native linters on +every commit — fast feedback without the container overhead. To +set it up: ```bash mise run setup:pre-commit-hook ``` This generates a `.git/hooks/pre-commit` that runs -`mise run pre-commit`, which uses `--native --autofix` to fix -formatting issues before the commit completes. +`mise run pre-commit`, which uses native mode for fast checks +without requiring a container. **For consuming repos**, add these tasks to your `mise.toml`: ```toml [tasks.pre-commit] -description = "Pre-commit hook: native lint with autofix" +description = "Pre-commit hook: native lint" depends = ["setup:native-lint-tools"] -run = "mise run lint:super-linter -- --native --autofix" +run = [{ task = "lint:super-linter", env = { NATIVE = "true" } }] [tasks."setup:pre-commit-hook"] description = "Install git pre-commit hook" diff --git a/mise.toml b/mise.toml index 49d9001..ace6abc 100644 --- a/mise.toml +++ b/mise.toml @@ -16,7 +16,7 @@ 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 = "mise run lint:super-linter -- --native" +run = [{ task = "lint:super-linter", env = { NATIVE = "true" } }] [tasks."setup:native-lint-tools"] description = "Install native lint tools matching the pinned super-linter version" @@ -42,10 +42,14 @@ depends = ["lint:super-linter", "lint:links", "lint:renovate-deps"] description = "Auto-fix lint issues and regenerate tracked deps" run = "AUTOFIX=true mise run lint" +[tasks.native-lint] +description = "Run lints natively (no container)" +run = "NATIVE=true mise run lint" + [tasks.pre-commit] -description = "Pre-commit hook: native lint with autofix" +description = "Pre-commit hook: native lint" depends = ["setup:native-lint-tools"] -run = "mise run lint:super-linter -- --native --autofix" +run = [{ task = "lint:super-linter", env = { NATIVE = "true" } }] [tasks."setup:pre-commit-hook"] description = "Install git pre-commit hook that runs native linting" diff --git a/tasks/lint/super-linter.sh b/tasks/lint/super-linter.sh index 0b58ef2..b208e5d 100755 --- a/tasks/lint/super-linter.sh +++ b/tasks/lint/super-linter.sh @@ -13,7 +13,10 @@ if [ "${usage_autofix:-}" = "true" ]; then fi # shellcheck disable=SC2154 # usage_native is set by mise -NATIVE="${usage_native:-false}" +if [ "${usage_native:-}" = "true" ]; then + NATIVE=true +fi +NATIVE="${NATIVE:-false}" # shellcheck disable=SC2154 # usage_full is set by mise LINT_ALL="${usage_full:-false}" From fef68890c04888a86df2ea3e4deb912086d25b77 Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Fri, 13 Mar 2026 11:36:27 +0000 Subject: [PATCH 2/4] add lint:fast grouping, use it for native-lint and pre-commit lint:fast runs super-linter + links (the fast lints). lint still runs everything including renovate-deps. native-lint and pre-commit now target lint:fast to avoid spawning Renovate. Signed-off-by: Gregor Zeitlinger --- README.md | 21 ++++++++++++++------- mise.toml | 10 +++++++--- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 1456414..f5e8056 100644 --- a/README.md +++ b/README.md @@ -94,9 +94,13 @@ Then wire up top-level `lint` and `fix` tasks that reference whichever tasks you adopted (add any project-specific subtasks to the `depends` list): ```toml +[tasks."lint:fast"] +description = "Run fast lints (no Renovate)" +depends = ["lint:super-linter", "lint:links"] + [tasks.lint] description = "Run all lints" -depends = ["lint:super-linter", "lint:links", "lint:renovate-deps"] +depends = ["lint:fast", "lint:renovate-deps"] [tasks.fix] description = "Auto-fix lint issues and regenerate tracked deps" @@ -104,7 +108,7 @@ run = "AUTOFIX=true mise run lint" [tasks.native-lint] description = "Run lints natively (no container)" -run = "NATIVE=true mise run lint" +run = "NATIVE=true mise run lint:fast" ``` Finally, extend the flint [Renovate preset](#automatic-version-updates-with-renovate) @@ -445,15 +449,18 @@ silently ignore the `AUTOFIX` environment variable. **Native mode:** ```bash -mise run native-lint # All lints, natively (no container) +mise run native-lint # Fast lints, natively (no container) # Or run directly: -NATIVE=true mise run lint # Same effect +NATIVE=true mise run lint:fast # Same effect mise run lint:super-linter -- --native # Single task with CLI flag ``` Native mode is useful in environments where Docker/Podman is -unavailable (e.g., inside containers, CI hooks). Tasks that don't -use a container (like `lint:links`) ignore the `NATIVE` variable. +unavailable (e.g., inside containers, CI hooks). `native-lint` +targets `lint:fast` (super-linter + links), skipping +`lint:renovate-deps` which requires the Renovate CLI. Tasks +that don't use a container (like `lint:links`) ignore the +`NATIVE` variable. ## Pre-commit hook @@ -475,7 +482,7 @@ without requiring a container. [tasks.pre-commit] description = "Pre-commit hook: native lint" depends = ["setup:native-lint-tools"] -run = [{ task = "lint:super-linter", env = { NATIVE = "true" } }] +run = "NATIVE=true mise run lint:fast" [tasks."setup:pre-commit-hook"] description = "Install git pre-commit hook" diff --git a/mise.toml b/mise.toml index ace6abc..489e783 100644 --- a/mise.toml +++ b/mise.toml @@ -34,9 +34,13 @@ file = "tasks/lint/links.sh" description = "Verify renovate-tracked-deps.json is up to date" file = "tasks/lint/renovate-deps.py" +[tasks."lint:fast"] +description = "Run fast lints (no Renovate)" +depends = ["lint:super-linter", "lint:links"] + [tasks."lint"] description = "Run all lints" -depends = ["lint:super-linter", "lint:links", "lint:renovate-deps"] +depends = ["lint:fast", "lint:renovate-deps"] [tasks.fix] description = "Auto-fix lint issues and regenerate tracked deps" @@ -44,12 +48,12 @@ run = "AUTOFIX=true mise run lint" [tasks.native-lint] description = "Run lints natively (no container)" -run = "NATIVE=true mise run lint" +run = "NATIVE=true mise run lint:fast" [tasks.pre-commit] description = "Pre-commit hook: native lint" depends = ["setup:native-lint-tools"] -run = [{ task = "lint:super-linter", env = { NATIVE = "true" } }] +run = "NATIVE=true mise run lint:fast" [tasks."setup:pre-commit-hook"] description = "Install git pre-commit hook that runs native linting" From 9d6cb797ea49354e3b79769b590251bcb8e61be6 Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Fri, 13 Mar 2026 11:39:21 +0000 Subject: [PATCH 3/4] fix README wording per review: clarify flag scope, drop redundant -- Signed-off-by: Gregor Zeitlinger --- README.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index f5e8056..201800a 100644 --- a/README.md +++ b/README.md @@ -420,11 +420,12 @@ committed `.github/renovate-tracked-deps.json`: ## How AUTOFIX and NATIVE Work -Lint scripts accept `--autofix` and `--native` flags. Both can also be -set as environment variables (`AUTOFIX=true`, `NATIVE=true`), which is -how the `fix` and `native-lint` meta-tasks propagate them through the -`depends` chain — mise's `depends` cannot forward CLI flags, but env -vars flow through naturally. +`lint:super-linter` accepts `--autofix` and `--native` flags. +Both can also be set as environment variables (`AUTOFIX=true`, +`NATIVE=true`), which is how the `fix` and `native-lint` +meta-tasks propagate them — mise's `depends` cannot forward CLI +flags, but env vars flow through naturally. Tasks that don't +recognize these variables simply ignore them. **Check mode** (default): @@ -452,7 +453,7 @@ silently ignore the `AUTOFIX` environment variable. mise run native-lint # Fast lints, natively (no container) # Or run directly: NATIVE=true mise run lint:fast # Same effect -mise run lint:super-linter -- --native # Single task with CLI flag +mise run lint:super-linter --native # Single task with CLI flag ``` Native mode is useful in environments where Docker/Podman is From 80bd631ff8eea64b163ebed103d00ba50d92d1a7 Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Thu, 19 Mar 2026 11:47:04 +0100 Subject: [PATCH 4/4] Update README.md Co-authored-by: Martin Costello --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 201800a..a838cb8 100644 --- a/README.md +++ b/README.md @@ -453,7 +453,7 @@ silently ignore the `AUTOFIX` environment variable. mise run native-lint # Fast lints, natively (no container) # Or run directly: NATIVE=true mise run lint:fast # Same effect -mise run lint:super-linter --native # Single task with CLI flag +mise run lint:super-linter --native # Single task with CLI flag ``` Native mode is useful in environments where Docker/Podman is