Skip to content

Code Quality

Linting

ESLint

ESLint checks TypeScript and JavaScript files using TypeScript-aware rules and Playwright-specific rules (e.g., no standalone expect, proper await on assertions).

CommandDescription
pnpm lintRun ESLint
pnpm lint:fixRun ESLint with auto-fix

Configuration: eslint.config.js

Markdownlint

Markdownlint checks markdown files in docs/ and the project root. Several rules are relaxed for VitePress compatibility (long lines, inline HTML, duplicate headings).

CommandDescription
pnpm lint:mdLint markdown files
pnpm lint:md:fixLint markdown files, auto-fix

Configuration: .markdownlint-cli2.jsonc

Formatting

Prettier handles all code formatting. It runs on TypeScript, JavaScript, JSON, YAML, CSS, and markdown files.

CommandDescription
pnpm formatFormat all files with Prettier
pnpm format:checkCheck formatting without changing

Configuration: .prettierrc

Git Hooks

A pre-commit hook runs linting and formatting checks automatically on every commit. Three packages work together to make this happen:

text
git commit
  └─ .git/hooks/pre-commit          (created by simple-git-hooks)
       └─ pnpm lint-staged           (runs lint-staged CLI)
            └─ lint-staged.config.mjs (defines which tools run on which files)

How It Works

  1. simple-git-hooks reads the "simple-git-hooks" section in package.json and writes a shell script to .git/hooks/pre-commit. The script calls pnpm lint-staged.

  2. lint-staged picks up lint-staged.config.mjs by naming convention. It runs the configured tools only on staged files, so commits stay fast regardless of project size.

  3. lint-staged.config.mjs defines the rules:

    File PatternTools
    *.{ts,js,mjs,cjs}ESLint, Prettier
    *.{json,yml,yaml,css}Prettier
    *.md (excl. .claude/)markdownlint
    .prettierrcPrettier

Regenerating Hooks

Changes to the "simple-git-hooks" config in package.json are not picked up automatically. After modifying the hook configuration, run:

bash
npx simple-git-hooks

This regenerates the .git/hooks/pre-commit script from the updated config.

First-Time Setup

After cloning the repository, the git hook doesn't exist yet. Running pnpm install does not set it up automatically. To install the hook:

bash
npx simple-git-hooks

Config Files

FilePurpose
eslint.config.jsESLint rules (TypeScript + Playwright)
.prettierrcPrettier formatting options
.prettierignoreFiles excluded from Prettier
.markdownlint-cli2.jsoncMarkdownlint rules and file globs
lint-staged.config.mjsPre-commit checks per file type
package.json (simple-git-hooks)Maps git hooks to commands

UI test suite for halOP — the WildFly management console