Back to Dagger

ESLint

docs/current_docs/modules/eslint.mdx

0.21.52.2 KB
Original Source

ESLint

Official module: dagger/eslint

Install with dagger mod install github.com/dagger/eslint.

What It Is

The ESLint module checks JavaScript and TypeScript source with ESLint.

Use it when the repo already has ESLint config and you want linting to run as a Dagger check.

Use It For

  • Catch code issues before a PR lands.
  • Run the same lint check locally and in CI.
  • Produce a repair workflow for fixable lint issues.

Main Workflows

  • lint: run ESLint and fail on lint errors.
  • fix: apply ESLint fixes and return corrected source.

How to Use It

Install the module, then run its check:

bash
dagger mod install github.com/dagger/eslint

dagger check             # run every check in the workspace
dagger check eslint:lint # run ESLint against the workspace source

lint installs dependencies and runs eslint . over the whole workspace using the project's own ESLint configuration, so the result matches what developers see locally.

Settings

List the current settings and their values with dagger settings eslint, then set one with dagger settings eslint <key> <value>. Settings are stored in .dagger/config.toml under [modules.eslint.settings].

  • packageManager (default npm): the package manager used to install dependencies before linting. Set it to yarn or pnpm to match the project, so the same lockfile and dependency versions are used.
  • baseImageAddress (default node:25-alpine): the Node base image ESLint runs in. Pin it to the project's Node version, for example node:22-alpine.
toml
[modules.eslint.settings]
packageManager = "pnpm"
baseImageAddress = "node:22-alpine"

Fixing issues

ESLint also exposes a fix function that runs eslint . --fix and returns the repaired source as a changeset (excluding node_modules). It is a regular function rather than a check, so it does not run during dagger check; call it with dagger function call (run dagger function list to see available functions).

Workspace Fit

Use ESLint with Prettier when the project separates lint rules from formatting. Use Biome when the project has moved linting and formatting into one tool.

Source

Source repo: github.com/dagger/eslint