Skip to content

chore(eslint): modernize ESLint 10 flat config - #506

Draft
curfew-marathon wants to merge 5 commits into
mainfrom
chore/eslint-10-cleanup
Draft

curfew-marathon wants to merge 5 commits into
mainfrom
chore/eslint-10-cleanup

Conversation

@curfew-marathon

@curfew-marathon curfew-marathon commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Delete the legacy .eslintrc.js (ESLint 10 ignores it) and rename eslint.config.js to eslint.config.mjs (the package is CommonJS, so ESM import needs .mjs).
  • Use ESLint 10 idioms: defineConfig and globalIgnores from eslint/config, js.configs.recommended, and the unified typescript-eslint flat preset in place of the separate plugin and parser plus the manual .configs.recommended.rules spread. Drop the redundant ecmaVersion, sourceType and globals.es2021.
  • js.configs.recommended was never applied by the flat config, even though the old legacy config extended eslint:recommended. Effective rules go from 27 to 95. The @typescript-eslint/* rules are identical.
  • indent, quotes, semi and linebreak-style are kept as is. They are deprecated since ESLint 8.53 (available until v11), but nothing else enforces formatting here.
  • Dependencies: remove @typescript-eslint/eslint-plugin and /parser, add typescript-eslint and @eslint/js. One eslint@10.12.0, every plugin names ESLint 10 in its peers, lockfile resolves only against registry.npmjs.org.
  • Fix the 5 new findings in code (empty catch, control char in a RegExp string, 2 useless assignments, a constant || new Set()). No behavior change and no rules disabled. None are in generated files.
  • .pre-commit-config.yaml: the eslint hook now runs on ts only, matching the config's **/*.ts scope.

Test plan

  • npm ci from a clean node_modules (Node 24.17.0)
  • npm run lint: 0 errors, 295 warnings. This is identical to the baseline on main (217 no-explicit-any, 78 no-unused-vars)
  • npm run build
  • npm test: 251/251 (run npm run pretest first on machines with ignore-scripts=true)
  • npx madge --circular . --extensions ts,js: no cycles
  • npm audit: 0 vulnerabilities (main now carries the follow-redirects and minimatch fixes 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-commit hook not run

Notes for merge

  • CI does not run lint today. Lint now exits 0, so adding npm run lint to CI would be reasonable as a follow-up.
  • Merge this before the paired sdk-generator PR (package template). That PR does not make the sync a no-op, because the template differs from js-sdk beyond the ESLint lines. See that PR for details.

🤖 Generated with Claude Code

curfew-marathon and others added 2 commits November 7, 2026 16:25
- 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>
@coderabbitai

coderabbitai Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
Pre-merge checks: Passed 1 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Title check Pending This assessment has not completed. The check will be retried on the next pre-merge check run.
Passed Passed checks: 1 passed

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@socket-security

socket-security Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedtypescript-eslint@​8.72.21001007498100
Added@​eslint/​js@​10.0.110010010085100

View full report

@codecov-commenter

codecov-commenter commented Nov 7, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 90.89%. Comparing base (5b75def) to head (804fe31).

Files with missing lines Patch % Lines
client.ts 0.00% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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>
curfew-marathon and others added 2 commits November 11, 2026 12:50
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>
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.

2 participants