Skip to content

ESLint

The ESLint plugin gives every package with an ESLint config a lint task, so each package is linted on its own and stays cached until something it reads changes.

Terminal window
axle add eslint

This writes it into the root axle.toml:

[plugins.eslint]
source = "npm:@axle-rs/[email protected]"
hash = "sha256-…"

A package or project with a flat config, eslint.config.ts, .mts, .cts, .js, .mjs or .cjs, in its folder gets a lint task, eslint .. The command runs through the repository’s package manager, such as pnpm exec eslint ., so it uses the ESLint the package installs. An .eslintrc of older ESLint versions doesn’t count.

Setting Value Why
inputs ["default", "{root}/eslint.config.*"] every file of the package, its own config among them, and the root config it usually extends
outputs [] ESLint writes nothing, so the task can run at the same time as the package’s other tasks

The packages ESLint’s config imports, plugins and shared configs, count through the package’s lockfile entries, like any dependency. A package whose config imports a file elsewhere in the repository, other than the root config, adds it in axle.toml:

[tasks.lint]
inputs = ["...", "{root}/tools/eslint/**"]

A package’s own script wins. When its package.json has a lint script that runs something else, such as eslint . --fix, the plugin leaves the task alone and Axle runs the script. A lint script of eslint or eslint . is replaced by the plugin’s task, which runs the same command and adds its settings.

Setting Default Meaning
lint "lint" the name of the task, or false to leave it out

The plugin’s answers are kept until an eslint.config.*, package.json, pnpm-workspace.yaml or lockfile changes.