Skip to content

chore(lint): let the linter see tests/ and scripts/ - #1446

Merged
rubenvdlinde merged 1 commit into
developmentfrom
chore/lint-covers-tests-and-scripts
Sep 1, 2026
Merged

chore(lint): let the linter see tests/ and scripts/#1446
rubenvdlinde merged 1 commit into
developmentfrom
chore/lint-covers-tests-and-scripts

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

npm run lint was eslint src, so tests/ and scripts/ were never linted. Here that hid 253 errors.

Most of it was the config, and the same two defects are in every fleet app:

  • scripts/ had no config block. CommonJS Node CLI checkers read as ESM, so require / process / __dirname reported as undefined identifiers. A scripts/** block declares the environment; a second covers scripts/**/*.mjs, which is genuinely ESM. Declaring beats suppressing no-undef — that rule is what catches a real typo.
  • The tests block applied the non-TypeScript-aware core no-unused-vars to .ts. It reads parameter names inside a function type as bindings, and double-reports every unused catch (e). Split: .js/.mjs on the core rule, .ts/.tsx on the TypeScript one.

Plus a stale eslint-disable n/no-unpublished-require naming a plugin eslint 10 no longer registers — an inline disable for an unregistered plugin is itself an error.

The real findings: 19 extensionless relative imports, 9 import() type annotations, dead initialisers, unused imports, and two == null comparisons spelled out so they still match null and undefined.

Verified: npm run lint 0 errors over src + tests + scripts, prettier --check clean, unit suite 22 files / 256 tests passed.

Built in a git worktree so the checkout another session is using was never switched.

`npm run lint` was `eslint src`, so two whole trees were never linted. Across
the fleet that hid roughly 3,900 errors, none of which any CI leg had shown.

Most of it was the config, not the code, and the same two defects were in
every app.

**scripts/ had no config block at all.** These are CommonJS Node CLI checkers,
and flat config defaults every `.js` to ESM with browser-ish globals, so eslint
read the CommonJS wrapper itself as undefined identifiers: `require`,
`process`, `__dirname`, `__filename`, `module`. A `scripts/**` block now
declares the environment. Declaring beats suppressing here: `no-undef` is the
rule that catches a genuinely misspelled identifier, and dozens of fake
findings would bury a real one. A second block covers `scripts/**/*.mjs`, which
is ESM and needs Node's globals without the CommonJS wrapper.

**The tests block applied a non-TypeScript-aware rule to TypeScript.** It named
`tests/**/*.ts` while setting the CORE `no-unused-vars`, which v9 deliberately
turns off for `.ts` in favour of the `@typescript-eslint` version. The core
rule reads the parameter names inside a function TYPE as bindings, so

    t?: (app: string, key: string) => string

reports `app` and `key` as unused variables, and every unused `catch (e)` in a
`.ts` spec reports twice. The block is split now: `.js`/`.mjs` on the core
rule, `.ts`/`.tsx` on the TypeScript one, same patterns on both.

Also: stale `eslint-disable` comments naming plugins eslint 10 no longer
registers, which are themselves errors ("Definition for rule ... was not
found"), and a rule that must not parse shell scripts.

The genuinely real findings were the useful part: dead locals, unused imports,
dead helper functions, unused `catch` bindings, extensionless relative imports,
and a handful of `== null` comparisons spelled out so they still match null AND
undefined.

Verified per app: `npm run lint` 0 errors over src + tests + scripts,
`prettier --check` clean, and the unit suite still green.
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/shillinq @ 0bfe46e

Check PHP Vue Security License Tests
lint
phpcs
phpmd
psalm
phpstan
phpmetrics
eslint
stylelint
build
check-manifest
check-manifest-shell
format
check-l10n-js
check-schema-l10n
check-manifest-budget
check-markers
check-registers
check-seeds
check-fragment-required
check-nav-reachability
check-job-registration
test-l10n
composer ✅ 106/106
npm ✅ 537/537
app:check-code ⏭️
info.xml
REUSE
PHPUnit
Newman
Playwright ⏭️ deferred — runs on the promotion into beta/main, not on a pull request into development
Hydra gates

Quality workflow — 2026-09-01 10:42 UTC

Download the full PDF report from the workflow artifacts.

@rubenvdlinde
rubenvdlinde merged commit 18bdeb4 into development Sep 1, 2026
57 checks passed
@rubenvdlinde
rubenvdlinde deleted the chore/lint-covers-tests-and-scripts branch September 1, 2026 10:43
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.

1 participant