Add formatting and linting (Prettier and ESLint) #77

Closed
opened 2026-10-08 16:33:32 -04:00 by goddard · 1 comment
Collaborator

The repo has no formatter or linter, so line length and style drift freely.

  • 1,080 lines are over 200 characters; the longest is 1,868 (collections/launches/[id]/+page.svelte:206).
  • There's no Prettier or ESLint config, and package.json:10-29 has no lint or format script.

CI is tracked separately in #100.

Fix

  • Add Prettier (with prettier-plugin-svelte), set to the current 4-space indent, and format the repo
  • Add ESLint (with eslint-plugin-svelte and typescript-eslint) and fix or suppress the existing errors
  • Add lint and format scripts to package.json
The repo has no formatter or linter, so line length and style drift freely. - 1,080 lines are over 200 characters; the longest is 1,868 (`collections/launches/[id]/+page.svelte:206`). - There's no Prettier or ESLint config, and `package.json:10-29` has no `lint` or `format` script. CI is tracked separately in #100. **Fix** - [x] Add Prettier (with `prettier-plugin-svelte`), set to the current 4-space indent, and format the repo - [x] Add ESLint (with `eslint-plugin-svelte` and `typescript-eslint`) and fix or suppress the existing errors - [x] Add `lint` and `format` scripts to `package.json`
goddard added the
priority
low
type/maintainability
labels 2026-10-08 16:39:19 -04:00
josh was assigned by goddard 2026-10-08 17:31:50 -04:00
goddard changed title from Add formatting/linting and CI; break up oversized files to Add formatting and linting (Prettier and ESLint) 2026-10-09 15:37:36 -04:00
Author
Collaborator

Reviewed 16469e2d43. Prettier and ESLint are in place, the whole repo passes npm run lint, and the reformat didn't change behaviour, so I'm closing this.

Checklist

  • Add Prettier and format the repo. .prettierrc.json uses prettier-plugin-svelte with a 4-space indent, single quotes and a 100-column width. .prettierignore skips the lockfile and the generated static/agent/. prettier --check . passes, and lines over 200 characters dropped from 1,080 to 57.
  • Add ESLint and fix or suppress the existing errors. eslint.config.js uses the recommended JavaScript, typescript-eslint and eslint-plugin-svelte configs, plus eslint-config-prettier. eslint . exits 0 with no warnings. Each of the four disabled Svelte rules has a comment, and every inline suppression gives a reason.
  • Add lint and format scripts. package.json has lint (prettier --check . && eslint .) and format (prettier --write .). Both READMEs list npm run lint with the other checks, and the development guide explains the setup.

Review notes

  • To confirm the 711-file reformat was formatting only, I ran the same Prettier config over the parent commit and diffed the result against this one. The 67 files that differ hold ESLint fixes:
    • void x for reactive dependency reads in $effect and $derived
    • let changed to const
    • unused code removed (composedCfgPath in beta.ts, getIntegrations in stores/fleet.ts, refreshedAt on the campaigns page)
    • ternary statements rewritten as if/else
    • { cause } added to rethrown errors
    • a redundant \/ escape dropped inside the regex classes in telemetry.ts (same match)
  • I checked the edits that could have changed behaviour:
    • the removed active = undefined in rebalancing/index.ts is never read afterwards
    • reason in status-evidence.ts and notice in maintenance/+server.ts are assigned on every path
    • the catch in DeployServerDialog.svelte never used its error
  • Checks run at HEAD:
    • npm run lint passes
    • npm run check reports 0 errors and 0 warnings across 1,192 files
    • the full suite passes (208 files, 2,629 tests)
    • npm run test:agent passes (285 tests)
    • npm run build succeeds
    • npm audit finds 0 vulnerabilities with the new dev dependencies
  • engines now requires Node 22.13 or newer for ESLint 10. The Dockerfile's node:22-alpine already meets that, and the development guide says so.
  • Minor and non-blocking: nothing runs npm run lint automatically yet; that's #100.
Reviewed 16469e2d43bcde12dd3a29c432a617f3c38c7049. Prettier and ESLint are in place, the whole repo passes `npm run lint`, and the reformat didn't change behaviour, so I'm closing this. **Checklist** - [x] **Add Prettier and format the repo.** `.prettierrc.json` uses `prettier-plugin-svelte` with a 4-space indent, single quotes and a 100-column width. `.prettierignore` skips the lockfile and the generated `static/agent/`. `prettier --check .` passes, and lines over 200 characters dropped from 1,080 to 57. - [x] **Add ESLint and fix or suppress the existing errors.** `eslint.config.js` uses the recommended JavaScript, `typescript-eslint` and `eslint-plugin-svelte` configs, plus `eslint-config-prettier`. `eslint .` exits 0 with no warnings. Each of the four disabled Svelte rules has a comment, and every inline suppression gives a reason. - [x] **Add `lint` and `format` scripts.** `package.json` has `lint` (`prettier --check . && eslint .`) and `format` (`prettier --write .`). Both READMEs list `npm run lint` with the other checks, and the development guide explains the setup. **Review notes** - To confirm the 711-file reformat was formatting only, I ran the same Prettier config over the parent commit and diffed the result against this one. The 67 files that differ hold ESLint fixes: - `void x` for reactive dependency reads in `$effect` and `$derived` - `let` changed to `const` - unused code removed (`composedCfgPath` in `beta.ts`, `getIntegrations` in `stores/fleet.ts`, `refreshedAt` on the campaigns page) - ternary statements rewritten as `if`/`else` - `{ cause }` added to rethrown errors - a redundant `\/` escape dropped inside the regex classes in `telemetry.ts` (same match) - I checked the edits that could have changed behaviour: - the removed `active = undefined` in `rebalancing/index.ts` is never read afterwards - `reason` in `status-evidence.ts` and `notice` in `maintenance/+server.ts` are assigned on every path - the `catch` in `DeployServerDialog.svelte` never used its error - Checks run at HEAD: - `npm run lint` passes - `npm run check` reports 0 errors and 0 warnings across 1,192 files - the full suite passes (208 files, 2,629 tests) - `npm run test:agent` passes (285 tests) - `npm run build` succeeds - `npm audit` finds 0 vulnerabilities with the new dev dependencies - `engines` now requires Node 22.13 or newer for ESLint 10. The Dockerfile's `node:22-alpine` already meets that, and the development guide says so. - Minor and non-blocking: nothing runs `npm run lint` automatically yet; that's #100.
Sign in to join this conversation.