Skip to content
Back to skills

Linting Formatting

ASecurity

Linting and formatting (ESLint, Biome, auto-fix)

  • 9 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added October 5, 2026
toolsgobash

Security analysis

A100/100

Scanned November 9, 2026

npx -y skills add JacobLey/leyman --skill linting-formatting --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Linting Formatting?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Linting Formatting
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/jacobley-linting-formatting/badge)](https://www.skillsdirectory.com/skills/jacobley-linting-formatting)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: linting-formatting
description: Linting and formatting (ESLint, Biome, auto-fix)
---

# Linting and Formatting

> Configs: [`../../../nx.json`](../../../nx.json) (targets: `eslint`, `biome`) · [`../../../biome.json`](../../../biome.json) · [`@leyman/eslint-config`](../../../leyman/eslint-config/)

ESLint does all linting. Biome does formatting only (its linter is disabled). Both are required to pass CI. Biome also formats YAML, with single quotes. Its Markdown formatting is off in `biome.json`.

## Running

```bash
nx run <project>:check            # format (writes), then eslint
nx run-many -t check -c fix       # also auto-fix lint

# A single tool on one project (work targets are `eslint` and `biome`;
# `check:lint` / `prepare:format` are the orchestration targets that wrap them)
nx run <project>:eslint -c fix --excludeTaskDependencies
nx run <project>:biome --excludeTaskDependencies
```

Formatting is part of the `prepare` stage, which runs before both `check` and `build`. It writes changes by default, and in CI (`CI` set) it only checks and fails on unformatted code. `-c check` checks without writing locally.

Linting is the `check` stage, which `build` and `test` don't depend on, so lint errors never block a quick build or test run. `verify` (and `test-ci`) runs both. Code changed by `eslint -c fix` is reformatted on the next run.

Biome is not cached by Nx (it is fast enough), ESLint is.

## ESLint config

How to use `@leyman/eslint-config` (its options, what each directory is held to, disabling a rule, running ESLint): the [`eslint-config` skill](../eslint-config/SKILL.md), which the package ships. In this repository:

- If a rule is wrong for this repo, change it in [`@leyman/eslint-config`](../../../leyman/eslint-config/) for every package rather than overriding it locally. Examples of package-wide disables: `unicorn/no-thenable` in juniper and genever, where `then` is a JSON Schema keyword, and `no-bitwise` in iso-crypto and punycode-esm.
- The `eslint` target runs from the workspace root, for `eslint-plugin-sonarjs`'s catalog lookup.

## Go

`golangci-lint` is held to the same bar: `.golangci.yml` at the workspace root turns on every linter (`linters.default: all`) and states a reason for each one it disables or excludes. It also picks the formatters (`gofumpt` and `goimports`), which `golangci-lint fmt` runs through the `gofmt` target. `golangci-lint run --fix` applies the fixes it can, from a project's directory.

Suppress one finding with `//nolint:<linter> // reason`, after trying to fix what it found. `nolintlint` fails a suppression with no reason, or one that no longer does anything. When a linter clashes with what a whole project does, add a rule for that path to `.golangci.yml`.

## Custom rules

Rules ship with the package whose code they are about, as an ESLint plugin on a `./eslint` entry point (e.g. `generated-signature/eslint`), not as separate `eslint-plugin-*` packages. A rule about no particular package goes in a standalone package that follows the same pattern, with the plugin as its main entry point.

### Writing a plugin

- Put the plugin under `src/eslint/` (entry `src/eslint/plugin.ts`, rules in `src/eslint/rules/`), exported as `"./eslint": "./dist/eslint/plugin.js"`. Files under any `eslint/` directory may name object methods in PascalCase, for AST visitors like `Program`.
- The main entry point must never import from `src/eslint/`. Import `eslint` for types only (`import type`), and declare it as an optional peer (`peerDependencies` + `peerDependenciesMeta.optional`) plus a devDependency. [`e2e/published-entrypoints`](../../../e2e/published-entrypoints/test/integration/eslint-entrypoints.spec.ts) checks all of this for every package with an `./eslint` export.
- The plugin has `meta.namespace` and a flat `configs.recommended` that turns on its rules and registers the plugin itself (`recommended.plugins = { [namespace]: plugin }`), so consumers can use it on its own. See [`generated-signature`'s plugin](../../../tools/generated-signature/ts/src/eslint/plugin.ts) and [`juniper`'s](../../../apps/juniper/src/eslint/plugin.ts).
- Each rule has `meta.docs.url` pointing at a `### \`<namespace>/<rule>\`` section of the package README, with a wrong and a right example.
- Prefer AST and import tracking over type information. Autofix only when the fix is always safe; no fix at all where it would just approve the problem.
- Test with ESLint's `RuleTester`, driven by `mocha-chain` (`RuleTester.describe = suite; RuleTester.it = test; RuleTester.itOnly = test.only;`), asserting `messageId`s rather than message text. Also test that `configs.recommended` works on its own with `new Linter().verify(...)`.

### Turning a plugin on in a project

Pass the plugin to `configGenerator`, which turns on its `configs.recommended` rules for the package's source files, except under `test/` (tests build fixtures freely, e.g. a schema per test). The project must depend on the package providing it:

```js
import configGenerator from '@leyman/eslint-config';
import generatedSignature from 'generated-signature/eslint';
import packageJson from './package.json' with { type: 'json' };

export default configGenerator({
    packageJson,
    plugins: [generatedSignature],
    configUrl: import.meta.url,
});
```

`@leyman/eslint-config` never imports a package's plugin itself: every package devDepends on it, so that would be a circular dependency. Nx builds the plugin's package before linting (its `dist` is an input of `eslint`), so rule changes apply to dependents without publishing. A package isn't linted by its own plugin.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in tools →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.