Skip to main content

Project configuration

:::info Available since v1.3.0 Project configuration and automatic zsh-lint.json discovery are part of the published v1.3.0 CLI. v1.2.0 accepts --config but has neither discovery nor --no-config; v1.1.0 rejects --config. :::

Project configuration gives rules explicit context that one syntax tree cannot provide, such as whether a source is an executable, sourced plugin entrypoint, autoloaded function, completion, or test fixture.

How a configuration is foundโ€‹

When --config is omitted, the CLI starts in each input file's directory and walks toward the filesystem root, using the nearest zsh-lint.json. Inputs found under the same configuration are analyzed together as one project; inputs under different configurations stay separate. A file with no configuration above it, or one that matches no configured source root, uses the default rule set. Certain rules, such as quoting/unquoted-var, report only for sources that belong to a configured project.

OptionEffect
(none)Discover the nearest zsh-lint.json for every input.
--config PATHUse one explicit configuration for every input; skip discovery.
--no-configDisable discovery and keep the unconfigured default rule set.

--config and --no-config are mutually exclusive.

Try the standalone exampleโ€‹

The source checkout's examples/standalone and examples/plugin directories contain the validated examples used on this page:

git clone https://github.com/z-shell/zsh-lint.git
cd zsh-lint
zsh-lint examples/standalone/script.zsh

Discovery picks up examples/standalone/zsh-lint.json. The explicit form gives the same result:

zsh-lint --config examples/standalone/zsh-lint.json \
examples/standalone/script.zsh

Minimal configurationโ€‹

{
"version": 2,
"project": {
"kind": "application",
"minimum_zsh": "5.8",
"identifier": "example-application"
},
"sources": [{"root": "script.zsh", "profile": "standalone-executable"}]
}

project.identifier is the one portable project identifier: lowercase ASCII letters, digits, and hyphens, starting and ending with a letter. Namespace rules derive shell-visible prefixes from it by replacing hyphens with underscores; nothing is inferred from a repository or directory name. project.kind is one of plugin, theme, zi-annex, module, library, tool, or application.

Paths are relative to the directory containing the configuration. Every input must stay under that directory and match one source root.

Source profilesโ€‹

ProfileUse it for
standalone-executableA script launched as its own process.
startup-fileFiles such as .zshrc or .zprofile.
sourced-libraryPlugin entrypoints and libraries loaded into an existing shell.
autoload-functionOne function body loaded through Zsh autoload.
test-fixtureTest inputs that should not inherit production lifecycle assumptions.

The optional completion role is valid only with autoload-function.

Plugin exampleโ€‹

zsh-lint examples/plugin/example.plugin.zsh \
examples/plugin/functions/example_run \
examples/plugin/completions/_example \
examples/plugin/tests/example-fixture.zsh

Configured analysis treats the complete explicit input list as one project. Files you omit are outside cross-file validation.

For the strict schema and failure contract, see the source-adjacent project configuration contract.