ci: run ESLint in CI to enforce the @objectstack/spec import guard#2029
Merged
Conversation
The repo had an ESLint flat config whose only rule — no-restricted-imports banning `@objectstack/spec` root namespace imports (the ~1.2GB RSS regression vector) — was never enforced: eslint wasn't even a devDep, no `lint` script existed, and the `lint.yml` workflow only ran tsc. The config's own comment said "To enable: pnpm add -DW eslint". So the guard that should have caught the root-import drift fixed in #2023 was dormant. - Add `eslint` + `@typescript-eslint/parser` devDeps; wire the parser into the flat config so .ts files parse. - Add root `lint` script (`eslint . --no-inline-config`). The flag ignores orphaned `eslint-disable` directives left over from a richer rule set this minimal config no longer registers; the sole active rule should never be opted out locally anyway. - Add a fast `lint` job to lint.yml (syntactic only, no build needed). Complements the example-app typecheck gate from #2023: typecheck catches concrete-type root imports, ESLint catches the namespace-name imports and gives a faster signal. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Actually run ESLint in CI so the existing import guard takes effect.
Why
The repo already had an ESLint flat config whose only rule —
no-restricted-imports, banning@objectstack/specroot namespace imports (the documented ~1.2GB RSS regression vector) — but it was completely dormant:eslintwasn't even a devDependency (the config's own comment said "To enable:pnpm add -DW eslint").lintscript.lint.ymlonly rantsc.So the guard that should have instantly caught the root-import drift fixed in #2023 had never run. This wires it up.
Changes
eslint+@typescript-eslint/parserdevDeps; wire the parser into the flat config so.tsfiles parse.lintscript:eslint . --no-inline-config. The flag ignores orphanedeslint-disabledirectives scattered in source (for@typescript-eslint/*,no-console, etc.) left over from a fuller rule set this minimal config no longer registers — without it,eslint .errors on "rule definition not found". The only active rule (the spec import guard) should never need a local opt-out anyway.lintjob tolint.yml(syntactic only — no build step).Coverage note
This guard bans the 15 namespace names (
Data,UI,System,Identity,Security, …) from the spec root. It does not yet catch concrete-type root imports (Datasource,Theme,Job, …) — those are covered by the example-app typecheck gate added in #2023. Together: typecheck catches concrete-type drift, ESLint catches namespace-name drift with a faster signal. Broadening the rule to anallowImportNamesallowlist (catching all type imports) is a sensible follow-up but needs a complete enumeration of legitimate root exports, so it's deliberately out of scope here.Two pre-existing items surfaced (not addressed here, to keep this focused):
eslint-disabledirectives across ~10 files referencing an unregistered rule set.Verification
Rule confirmed firing on a deliberate
import { UI } from '@objectstack/spec'.🤖 Generated with Claude Code