Skip to content

chore(dx): backend ESLint, root scripts, dev CORS, CONTRIBUTING and Dependabot - #67

Merged
Jeanball merged 7 commits into
Jeanball:developfrom
npozs77:chore/dev-experience
Nov 25, 2026
Merged

Jeanball merged 7 commits into
Jeanball:developfrom
npozs77:chore/dev-experience

Conversation

@npozs77

@npozs77 npozs77 commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Summary

The next steps of #45, in the order listed there: backend ESLint, root npm scripts, the dev CORS fix, CONTRIBUTING and Dependabot. Part of #45. The Node 24 step and the npm audit pass change what ships, so they will come in a separate pull request, after this one.

Changes

  • fix(lint): resolve the backend ESLint errors: 10 findings, no behaviour change (an unused import, an unused next parameter, two unused catch bindings, a let that is never reassigned, and a comment on the Express Request namespace augmentation, which has no module-syntax form).
  • ci(backend): add ESLint and run it in CI: flat config in the style of the frontend's (@eslint/js and typescript-eslint recommended, Node globals), same ESLint 9 and typescript-eslint ranges, and a lint step in the CI Backend job. The 45 existing uses of any are warnings rather than errors, so the step can be required now and the types tightened one file at a time. npm run lint ends with 0 errors and 44 warnings (one any was among the fixed lines).
  • chore: add root npm scripts for lint, test, build and check: npm run check runs what CI runs, for frontend and backend. Also install:all. Existing scripts untouched.
  • fix(cors): accept localhost and LAN origins in development: npm run dev starts Vite with --host and prints a Network URL, but the development default only listed localhost:5173 and :3000. On 127.0.0.1, the LAN address, or Vite's next port when 5173 is taken, every API call failed with Not allowed by CORS, and the login page looked like a wrong password. In development without CORS_ORIGINS, loopback and private-network (10/8, 172.16/12, 192.168/16) origins are now accepted on any port. Production and an explicit CORS_ORIGINS behave as before. The decision moved into config/cors.config.ts so it can be tested.
  • docs: add CONTRIBUTING.md and point the README and PR template to it: develop as the base, branch names, Conventional Commits, npm run check, changelog, translations. The PR template checklist uses npm run check.
  • ci(dependabot): add a monthly grouped update against develop: monthly, one pull request for all ecosystems (npm in the root, frontend and backend, GitHub Actions, both Dockerfiles) using a multi-ecosystem group, targeting develop. The first run also brings the older actions in docker-publish.yml up to date. Weekly is a one-line change.

How it was verified

  • npm run check at the root: 0 lint errors (frontend 8 warnings, backend 44), 162 frontend and 221 backend tests pass, both builds pass. 33 new tests for cors.config: the origin lists in each mode (pinning that getCorsOrigins still behaves as the code it replaced), when the local-network rule applies, and accepted and rejected origins, including look-alike hosts such as localhost.example.com and 172.32.0.1.
  • CORS against a running backend on a spare port with an empty database (POST /api/auth/login, 400 = past CORS, 500 = Not allowed by CORS):
    • NODE_ENV=development: localhost:5173, localhost:5174, 127.0.0.1:5173 and 192.168.1.15:5173 pass; https://example.com is rejected.
    • NODE_ENV=production with CORS_ORIGINS=https://app.example.com: everything else is rejected, including localhost.
    • Development with CORS_ORIGINS=http://localhost:5173: only that origin passes.
  • .github/dependabot.yml was validated against the SchemaStore Dependabot schema (it accepts the file and rejects a deliberately broken one). GitHub itself has not read it yet: Dependabot reads the file from the default branch, so it takes effect with the next merge into main, and any problem will show on the repository's Dependabot page.

Not checked: the new lint step has not run in CI yet (it passes locally with the same npm ci install), and the CORS fix was not tried from a second device on the LAN.

Checklist

  • Targets develop (not main)
  • Title follows Conventional Commits with a scope, e.g. fix(discogs): …
  • Line added to CHANGELOG.md under ## [Unreleased]
  • npm run check passes (lint, tests and build, frontend and backend)
  • New UI strings added to all locales (none needed)
  • Data changes come with a migration in backend/src/scripts/migration-runner.ts (none needed)
  • Screenshots attached for UI changes (none)

npozs77 and others added 7 commits November 19, 2026 13:46
Remove an unused import, an unused `next` parameter and two unused catch
bindings, make a `let` that is never reassigned a `const`, and keep the Express
`Request` namespace augmentation with a comment saying why it needs one.
No behaviour change.
Flat config in the style of the frontend's: @eslint/js and typescript-eslint
recommended, Node globals, `dist`, `logs` and `uploads` ignored. The 45
existing uses of `any` are reported as warnings instead of errors, so the lint
step can be required now and the types tightened one file at a time. Same
ESLint 9 and typescript-eslint ranges as the frontend.
`npm run check` runs what CI runs for frontend and backend, so it can be run
before pushing. `install:all` installs the root, frontend and backend
dependencies. The existing scripts are untouched.
Vite's --host prints a Network URL, and Vite moves to the next port when 5173 is
taken, but the development default only listed localhost:5173 and :3000. Opening
the app on 127.0.0.1 or the LAN address made every API call fail with
"Not allowed by CORS", and the login page then looked like a wrong password.

In development without CORS_ORIGINS, also accept loopback and private-network
origins on any port. Production and an explicit CORS_ORIGINS list behave exactly
as before. The decision moves to config/cors.config.ts so it can be tested.
Branches from and pull requests against develop, Conventional Commits, tests
with every change, npm run check before pushing, the changelog, translations and
migrations, and no version bumps. The pull request template checklist uses
npm run check instead of listing the commands for each side.
One pull request a month for all ecosystems (npm in the root, frontend and
backend, GitHub Actions, and both Dockerfiles), using a multi-ecosystem group so
it stays one rather than six. Pull requests target develop. The first run also
brings the older actions in docker-publish.yml up to date.
@Jeanball
Jeanball merged commit f0dc2f2 into Jeanball:develop Nov 25, 2026
5 checks passed
@npozs77
npozs77 deleted the chore/dev-experience branch November 25, 2026 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants