Add ESLint configuration and fix linting issues across monorepo packages - #348
Open
AnnieIj wants to merge 3 commits into
Open
Add ESLint configuration and fix linting issues across monorepo packages#348AnnieIj wants to merge 3 commits into
AnnieIj wants to merge 3 commits into
Conversation
Centralize ESLint in the root flat config (eslint.config.js) so every workspace package inherits the same rules: type-aware linting via each package's tsconfig, consistent type imports, and no-floating/misused promise enforcement. Add lint scripts to access-api and contracts, a root lint:fix script, Node globals for JS files, and a CI workflow that runs lint and typecheck. Fixes lint errors across the monorepo and keeps pre-existing build-order gaps working (contracts prepare script, @types/node for discord-bot).
Contributor
|
This PR cannot be merged automatically because it has merge conflicts. Please update the branch with the latest base branch and resolve the conflicts. After the conflicts are resolved and checks pass, the automation can review it again. |
Resolve conflicts with upstream main (guild-scoped multi-tenancy, auth/CSRF routes, new env/contracts packages, access-api backfill/leader-election, and other merged features). Lint fixes from the ESLint PR are reapplied on top of the merged code, and pre-existing upstream issues are left untouched: - dashboard tsconfig no longer maps @guildpass/env to package source (broke rootDir/typecheck); the package now builds via its prepare script - hash-chain tests pass guildId to the guild-scoped append() signature - upstream main's access-api typecheck remains broken there (code references Prisma models absent from the committed schema) — unrelated to this PR
CI failed at setup-node because actions/setup-node's pnpm cache requires a pnpm-lock.yaml, but lock files are untracked in this repo — remove the cache option. Also fix upstream's pre-existing access-api typecheck breakage (code referenced Prisma models missing from the committed schema): add the FailedEvent model and ProcessedEvent.previousState field to schema.prisma, and make applyEventApplication snapshot the pre-application membership state so previousState is actually populated. The dead-letter retry path (retryFailedEvent/getDeadLetterMetrics) now typechecks.
Contributor
Author
|
@Lakes41 all merged and all CI checked. Thanks |
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.
Description
Adds a single, shared ESLint configuration for the whole monorepo and fixes all linting issues so
pnpm lintruns cleanly.The repo already runs ESLint 10 (flat config only —
.eslintrcfiles are no longer supported), so the shared config lives in the rooteslint.config.jsand is inherited automatically by every workspace package. No per-package configs are needed.Linked Issue
Closes #339
Type of Change
Changes Made
eslint.config.js— the unified flat config every package inherits:eslint:recommended+typescript-eslintrecommendedtsconfig.jsonis registered (withtsconfig.base.jsonas fallback), so rules likeno-floating-promises/no-misused-promisesnow run with full type informationconsistent-type-imports(error),no-floating-promises(error),no-misused-promises(error),no-non-null-assertion(warn)no-explicit-anykept as a warning (per the issue's suggested config) — visible in the editor without blocking CIBuffer,URL,fetch, timers, …) added for.js/.cjs/.mjsfilesdist,node_modules,.next, docs build output)no-floating-promisesdisabled for*.test.tsandtest/helpers: node:test's top-leveltest()/describe()return promises that the runner itself awaits, so flagging them is a false positivepackage.json— addedlint:fixscript (eslint . --fix)apps/access-api&packages/contracts— added missinglintscripts sopnpm -r lintcovers every packagepackages/contracts— addedpreparescript (matches sibling packages) so itsdistis built on install and@guildpass/contractsresolves on a fresh cloneapps/discord-bot— added@types/node(tsconfig declarestypes: ["node"]but it was missing)interface extends {}→ type alias, unawaitedload()/mutate()calls in dashboard pages and hooks (nowvoid/.catch()), async handlers extracted out ofonClickprops, andimport typeconversions.github/workflows/ci.yml— new CI workflow: installs with pnpm, runspnpm lint, runspnpm typecheck, fails on violationsTest Evidence
pnpm lint— passes across all 7 packages (0 errors; remaining warnings are intentionalno-explicit-any/no-non-null-assertionwarnings)pnpm lint:fix— runs cleanpnpm typecheck— passes in all 7 packagespnpm test— all tests pass (dashboard 47/47, access-api 2/2, webhook-utils)Checklist
pnpm typecheckpasses with no errorspnpm lintpasses (or issues are pre-existing and documented)pnpm testpasses (all existing tests still pass)pnpm dev:docs.env.exampleAdditional Notes
The lint fixes in the dashboard are behavior-preserving:
load()/mutate()calls now usevoidor.catch(() => {})(errors were already surfaced via each mutation'sonError→ alert), and the two inline asynconClickhandlers were extracted into namedhandleInvite/handleCreatefunctions.