feat(eslint-config): shared ESLint 9 flat config, and fix this repo's lint - #98
Merged
Conversation
Adds @constructive-io/eslint-config, a build-free leaf package that ports the legacy .eslintrc.json rule set to flat config, and consumes it from the repo root so pnpm lint works under eslint 9.
Ports of the legacy rule set surface three classes of pre-existing errors that are not code smells: empty interfaces used as extension points (relaxed in the shared config via allowInterfaces), ANSI control characters in the terminal packages, and the vendored noble-hashes port (both scoped to this repo's eslint.config.mjs). Generated __fixtures__/output is ignored.
Mechanical output of `eslint . --fix` under the new flat config (mostly import sorting and unused-import removal), plus a few hand fixes for rules autofix can't handle: useless escapes in strfy-js regexes, useless try/catch rethrows, and comments in empty catch blocks. No behavior changes.
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
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.
Summary
pnpm linthas been dead in every Constructive repo since the eslint 8→9 bump — eslint 9 only reads flat config, and we only ship.eslintrc.json. This adds@constructive-io/eslint-config@0.1.0, a faithful flat-config port of that rule set, and dogfoods it here.Consumers get 3 lines:
The package is deliberately a leaf. No build step (hand-written
index.mjs+index.d.ts), nomakageanywhere in its dependency graph — somakagecan devDepend on it without a publish cycle. Because there's nodist/, it's the one package here that publishes from the package root (files: [index.mjs, index.d.ts, README.md, LICENSE]) rather thanpublishConfig.directory: dist.Surface:
Verified
--print-configagainst the old.eslintrc.jsonsemantics (parser, plugins,indent/quotes/quote-props/semi, warn-level import sorting and unused vars, theofflist, browser+node+es2021+jest globals), and verified an out-of-repo consumer bynpm packing the tarball into a scratch project and linting a file with it.Two deviations from a literal port
The old config was written against
@typescript-eslintv6-erarecommended; on v8 the same "recommended" pulls in rules that flag pre-existing, non-buggy code. Rather than edit 300+ sites:@typescript-eslint/no-empty-object-typerelaxed to{ allowInterfaces: 'always' }— empty interfaces are used across our repos as extension points (interface ParserOptions {}) and as named aliases (interface JSONStringifyOptions extends Omit<...> {}). Also addedno-require-imports: offalongside the already-offno-var-requires(v8 renamed it).eslint.config.mjs(not the shared package):no-control-regexoff foryanse/clean-ansi/inquirerer(they match ANSI escapes on purpose), all ofnoble-hashesexempted fromno-unused-expressions/no-empty-object-type(vendored upstream port, keep it diffable), and**/__fixtures__/output/**ignored (codegen output).Commits
eslint.config.mjs,.eslintrc.jsondeletedeslint . --fixchurn across 176 files — almost entirely import sorting and unused-import removalNo behavior changes. The only non-autofixable hand edits, all semantics-preserving: dropped 3
catch (e) { throw e }rethrows, removed useless regex escapes instrfy-js/src/utils.ts(/\/[^\/]*$/→/\/[^/]*$/), and put comments in 2 emptycatch {}blocks.pnpm lintnow exits 0 (38no-unused-varswarnings remain, warn-level by design);pnpm buildandpnpm testpass (schema-ts-cliandyamlize-clifail with "no tests found" onmaintoo; neither is in the CI matrix).Follow-ups (not in this PR)
pgsql-parser,constructive,constructive-db, etc. — one 3-lineeslint.config.mjsper repo, after this publishes.eslint.config.mjsso new repos aren't born broken.Context: surfaced in constructive-io/pgsql-parser#329 / constructive-io/constructive-planning#1336.
Link to Devin session: https://app.devin.ai/sessions/3b5f5e76ddc74eda83a3543d7da2c75f
Requested by: @pyramation