Repository navigation
chore(eslint): modernize ESLint 10 flat config - #506
Draft
curfew-marathon wants to merge 5 commits into
Draft
curfew-marathon wants to merge 5 commits into
curfew-marathon wants to merge 5 commits into
Conversation
- Delete .eslintrc.js; ESLint 10 ignores it and eslint.config is the only config. - Rename eslint.config.js to eslint.config.mjs. The package is CommonJS, so ESM `import` syntax needs the .mjs extension; this matches the other OpenFGA repos' ESLint 10 configs. - Use defineConfig and globalIgnores from eslint/config. - Apply js.configs.recommended, which the flat config never imported even though the removed legacy config extended eslint:recommended. - Replace @typescript-eslint/eslint-plugin and /parser and the manual `.configs.recommended.rules` spread with the unified typescript-eslint package and its flat recommended preset. Add @eslint/js. - Drop redundant ecmaVersion, sourceType and globals.es2021. - Keep indent, quotes, semi and linebreak-style as they are; they are deprecated since ESLint 8.53 (available until v11) but nothing else enforces formatting in this repo. - pre-commit: run the eslint hook on ts files only, matching the config's `**/*.ts` scope instead of passing js/tsx files it never lints. Co-Authored-By: Claude <noreply@anthropic.com>
Fixes from js.configs.recommended and ESLint 10's updated recommended set,
with no behavior change:
- no-empty (client.ts): document the intentionally empty catch.
- no-control-regex (common.ts): write the tab as `\\t` so the RegExp
receives an escape instead of a raw control character.
- no-useless-assignment (common.ts): drop the `{}` initializer that is
overwritten before use.
- no-constant-binary-expression (telemetry/attributes.ts): remove the
unreachable `|| new Set()`; `new Set(undefined)` is already empty.
Co-Authored-By: Claude <noreply@anthropic.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: truePre-merge checks:
|
1 of 3 tasks
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #506 +/- ##
==========================================
+ Coverage 90.58% 90.89% +0.30%
==========================================
Files 25 25
Lines 6535 6535
Branches 348 347 -1
==========================================
+ Hits 5920 5940 +20
+ Misses 597 581 -16
+ Partials 18 14 -4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The audit job was already failing on main. Bump follow-redirects to 1.16.2 (GHSA-mrwp-f3q8-3g9p, high) with npm update, and override minimatch to ^11.0.1 (GHSA-g3hv-75wg-m249). eslint, @eslint/config-array and @typescript-eslint/typescript-estree still depend on minimatch ^10, which has no patched release, so the override is the only fix short of downgrading eslint. Remove it once those packages depend on minimatch >=11.0.1. Co-Authored-By: Claude <noreply@anthropic.com>
main landed the follow-redirects bump (#501) and the minimatch override (#508) that this branch's audit commit also made, plus dependency bumps (#507, #509). Resolve package.json by keeping main's versions and the typescript-eslint and @eslint/js swap, and regenerate the lockfile with npm install against registry.npmjs.org. Co-Authored-By: Claude <noreply@anthropic.com>
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
.eslintrc.js(ESLint 10 ignores it) and renameeslint.config.jstoeslint.config.mjs(the package is CommonJS, so ESMimportneeds.mjs).defineConfigandglobalIgnoresfromeslint/config,js.configs.recommended, and the unifiedtypescript-eslintflat preset in place of the separate plugin and parser plus the manual.configs.recommended.rulesspread. Drop the redundantecmaVersion,sourceTypeandglobals.es2021.js.configs.recommendedwas never applied by the flat config, even though the old legacy config extendedeslint:recommended. Effective rules go from 27 to 95. The@typescript-eslint/*rules are identical.indent,quotes,semiandlinebreak-styleare kept as is. They are deprecated since ESLint 8.53 (available until v11), but nothing else enforces formatting here.@typescript-eslint/eslint-pluginand/parser, addtypescript-eslintand@eslint/js. Oneeslint@10.12.0, every plugin names ESLint 10 in its peers, lockfile resolves only against registry.npmjs.org.|| new Set()). No behavior change and no rules disabled. None are in generated files..pre-commit-config.yaml: the eslint hook now runs ontsonly, matching the config's**/*.tsscope.Test plan
npm cifrom a cleannode_modules(Node 24.17.0)npm run lint: 0 errors, 295 warnings. This is identical to the baseline onmain(217no-explicit-any, 78no-unused-vars)npm run buildnpm test: 251/251 (runnpm run pretestfirst on machines withignore-scripts=true)npx madge --circular . --extensions ts,js: no cyclesnpm audit: 0 vulnerabilities (main now carries thefollow-redirectsandminimatchfixes from chore(deps): bump follow-redirects from 1.16.1 to 1.16.2 #501 and chore(deps): override minimatch to ^11.0.1 #508, so this PR no longer touches them)pre-commithook not runNotes for merge
npm run lintto CI would be reasonable as a follow-up.🤖 Generated with Claude Code