Skip to content

chore(deps): upgrade ESLint 8 → 10 with flat config migration - #3021

Open
kopernic-pl wants to merge 10 commits into
developfrom
chore/eslint-10-upgrade
Open

chore(deps): upgrade ESLint 8 → 10 with flat config migration#3021
kopernic-pl wants to merge 10 commits into
developfrom
chore/eslint-10-upgrade

Conversation

@kopernic-pl

Copy link
Copy Markdown
Contributor

Summary

  • Upgrades ESLint from ^8.22.0 to ^10.0.0
  • Migrates from legacy .eslintrc + .eslintignore to flat config (eslint.config.mjs)
  • Upgrades @typescript-eslint/eslint-plugin and @typescript-eslint/parser from v5 to v8
  • Replaces eslint-plugin-import with eslint-plugin-import-x (maintained fork with ESLint 10 support)
  • Upgrades eslint-plugin-prettier v4 → v5 and prettier v2 → v3
  • Adds globals package (replaces env: declarations in flat config)
  • Removes .eslintrc and .eslintignore; adds .prettierignore for prettier scripts

Breaking changes handled

  • Renamed @typescript-eslint/no-throw-literalonly-throw-error
  • Removed defunct rules: camelcase, ban-ts-ignore, ban-types
  • Renamed no-var-requiresno-require-imports
  • Replaced eslint-plugin-import with eslint-plugin-import-x (context.getFilename was removed in ESLint 10)
  • Removed /* eslint-env */ comments (not supported in flat config)
  • Restored explicit type cast in ruleset-bundler/src/loader/common/utils.ts that TypeScript 4.7 requires but 4.9 infers automatically

Test plan

  • yarn lint.eslint — 0 errors, 37 warnings (all pre-existing)
  • yarn build — passes
  • yarn test.jest — 199/200 suites pass (1 pre-existing unrelated failure in ruleset-migrator fixture, present on develop before this change)

🤖 Generated with Claude Code

@kopernic-pl
kopernic-pl requested review from a team, jonaslagoni and smoya as code owners July 31, 2026 09:34
Patrycja-dz
Patrycja-dz previously approved these changes Jul 31, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR upgrades the repo’s linting/formatting toolchain to ESLint 10 + Prettier 3, migrates configuration to ESLint flat config (eslint.config.mjs), and applies the resulting type/lint-driven code cleanups across packages.

Changes:

  • Upgrade ESLint 8 → 10, @typescript-eslint/* v5 → v8, Prettier 2 → 3, and replace eslint-plugin-import with eslint-plugin-import-x.
  • Migrate from .eslintrc/.eslintignore to eslint.config.mjs, and introduce .prettierignore.
  • Apply formatting and type-safety adjustments across rulesets, core, bundler, CLI, and formatter packages to satisfy updated lint rules.

Reviewed changes

Copilot reviewed 54 out of 58 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
yarn.lock Updates lockfile for ESLint 10 / TS-ESLint v8 / Prettier 3 dependency graph.
packages/rulesets/src/shared/functions/serverVariables/index.ts Adjusts server variable typing and enum/default handling to satisfy updated TS-ESLint rules.
packages/rulesets/src/oas/functions/oasSecurityDefined.ts Formatting-only ternary alignment for lint compliance.
packages/rulesets/src/oas/functions/oasDocumentSchema.ts Adds spacing to satisfy formatting/lint rules.
packages/rulesets/src/oas/tests/oas3-unused-component.test.ts Fixes $ref construction to use Document.source explicitly.
packages/rulesets/src/asyncapi/functions/utils/specs.ts Removes inline ESLint disables; formatting update.
packages/rulesets/src/asyncapi/functions/utils/mergeTraits.ts Adds targeted lint disable for any typing.
packages/rulesets/src/asyncapi/functions/asyncApi2MessageExamplesValidation.ts Tightens traits typing from any[] to unknown[].
packages/rulesets/src/arazzo/functions/types/arazzoTypes.ts Simplifies redundant unions (`unknown
packages/rulesets/src/arazzo/functions/arazzoWorkflowOutputNamesValidation.ts Simplifies runtime expression validation call.
packages/rulesets/src/arazzo/functions/arazzoWorkflowDependsOnValidation.ts Simplifies callback typing for dependency iteration.
packages/rulesets/src/arazzo/functions/arazzoStepOutputNamesValidation.ts Simplifies runtime expression validation call.
packages/rulesets/src/arazzo/functions/tests/arazzoWorkflowOutputNamesValidation.test.ts Removes as any from inventory mocks.
packages/rulesets/src/arazzo/functions/tests/arazzoStepOutputNamesValidation.test.ts Removes as any from inventory mocks.
packages/rulesets/src/arazzo/functions/tests/arazzoStepIdUniqueness.test.ts Removes as any from inventory mocks.
packages/rulesets/src/tests/helpers/tester.ts Tightens Document generic from any to unknown.
packages/rulesets/jest.setup.mjs Removes eslint-env comment (flat-config migration).
packages/ruleset-bundler/src/plugins/skypack.ts Removes unnecessary type assertion around returned plugin object.
packages/ruleset-bundler/src/plugins/builtins.ts Simplifies external callback typing.
packages/ruleset-bundler/src/plugins/tests/builtins.spec.ts Removes now-unneeded lint suppression comments in tests.
packages/ruleset-bundler/src/loader/node.ts Expands lint disable to include no-unsafe-call for dynamic Function invocation.
packages/ruleset-bundler/src/loader/browser.ts Expands lint disable to include no-unsafe-call for dynamic Function invocation.
packages/ruleset-bundler/src/index.ts Formatting of ternary predicate for readability/lint compliance.
packages/ruleset-bundler/jest.setup.mjs Removes eslint-env comment (flat-config migration).
packages/functions/src/undefined.ts Removes lint suppression comment (flat-config migration).
packages/functions/src/schema/index.ts Removes now-unneeded lint suppression comment.
packages/functions/src/schema/ajv.ts Removes now-unneeded lint suppression comments while keeping logic intact.
packages/formatters/src/utils/xmlEscape.ts Removes lint suppression comment; keeps XML escaping regex behavior.
packages/formatters/src/stylish.ts Updates disabled rule name to no-require-imports.
packages/formatters/src/sarif.ts Uses nullish coalescing for helpUri assignment.
packages/formatters/src/pretty.ts Updates disabled rule name to no-require-imports.
packages/formatters/src/markdown.ts Adds lint suppression for enum comparison typing.
packages/formatters/src/junit.ts Adds lint suppression for enum comparison typing.
packages/formatters/src/html/index.ts Adds template map cast to satisfy indexing/type checks.
packages/formatters/src/code-climate.ts Formats union type into a single-line union for lint/format compliance.
packages/formatters/src/tests/pretty.jest.test.ts Adjusts formatting of expect(...).toContain(...) for lint/format compliance.
packages/core/src/utils/replacer.ts Adds targeted lint suppression and removes unnecessary type assertion on bind.
packages/core/src/spectral.ts Formatting-only ternary indentation update.
packages/core/src/runner/lintNode.ts Fixes ternary grouping and formatting for message selection.
packages/core/src/ruleset/validation/validators/function.ts Simplifies validateFunction signature typing.
packages/core/src/ruleset/validation/errors.ts Adjusts flattening of aggregate errors to satisfy typing (see review comment).
packages/core/src/ruleset/types.ts Flattens union formatting for RulesetExtendsDefinition.
packages/core/src/ruleset/ruleset.ts Constructor formatting + minor typing simplification on mergedOverrides.
packages/core/src/ruleset/function.ts Adds no-require-imports suppression for require(...) import assignment.
packages/core/src/ruleset/tests/ruleset.test.ts Prefixes unused param with _ to satisfy unused-vars rule.
packages/core/src/documentInventory.ts Constructor formatting; removes lint suppression comment.
packages/core/src/document.ts Constructor formatting for lint/format compliance.
packages/cli/src/services/linter/utils/readFileDescriptor.ts Fixes stream read typing and safely appends Buffer/string chunks.
packages/cli/src/services/linter/utils/getRuleset.ts Expands lint disable to include no-unsafe-call for dynamic Function invocation.
packages/cli/src/services/linter/utils/getResolver.ts Updates disabled rule name to no-require-imports.
packages/cli/src/index.ts Updates disabled rule name to no-require-imports for hpagent require.
packages/cli/src/commands/lint.ts Removes unnecessary tty type import and simplifies stdin fd usage.
package.json Updates devDependencies + adjusts lint scripts for flat config and .prettierignore.
eslint.config.mjs Adds new ESLint flat config with TS-ESLint v8 + import-x + globals wiring.
.prettierignore Adds Prettier ignore list replacing .eslintignore usage.
.eslintrc Removes legacy ESLint config (replaced by flat config).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread eslint.config.mjs
Comment thread packages/core/src/ruleset/validation/errors.ts Outdated
kopernic-pl and others added 8 commits July 31, 2026 13:04
- ESLint 8 → 10, @typescript-eslint v5 → v8, typescript-eslint umbrella pkg
- prettier v2 → v3, eslint-plugin-prettier v4 → v5, eslint-config-prettier v9
- eslint-plugin-import → eslint-plugin-import-x (ESLint 10 compat)
- globals ^16 added (replaces env: declarations in flat config)
- TypeScript 4.4.4 → 4.9.5 (required by @typescript-eslint v8)
- .eslintrc + .eslintignore removed; replaced by eslint.config.mjs
- .prettierignore created (prettier scripts previously used .eslintignore)
- Removed --ext flag from lint.eslint script (removed in ESLint 9)
- Renamed no-throw-literal → only-throw-error, removed deprecated rules
  (ban-types, ban-ts-ignore, camelcase) from config
- prefer-optional-chain moved to type-checked block only
- Fixed TypeScript 4.9 narrowing regression in serverVariables/index.ts
- Fixed AggregateError.errors type cast for TypeScript 4.9 compat

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
prettier.format() is now async in v3; update standalone plugin imports
from prettier/parser-babel to prettier/plugins/babel + prettier/plugins/estree,
and declare the actual resolved version (^3.0.0) in the package's deps.

Also broaden the ESLint test-file override glob to cover __tests__/**
(was __tests__/*.ts, missing __helpers__ subdirectories), and revert
Document<unknown, unknown> to Document<any, any> in tester.ts where
TypeScript 4.7 requires any to satisfy the IParserResult constraint.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Aligns declared version with what Yarn actually resolves via workspace hoisting.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
… in flatErrors

The previous cast to (RulesetValidationError | AggregateError)[] was
unsound — AggregateError.errors is untyped by spec and can hold arbitrary
values. Rewrite flatErrors to accept unknown, narrow with instanceof/
isAggregateError at runtime, and always return RulesetValidationError[].
This eliminates the cast, drops the Array.isArray branch in the caller,
and silently discards unexpected entries rather than propagating them
typed as RulesetValidationError.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…during rebase

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@kopernic-pl
kopernic-pl force-pushed the chore/eslint-10-upgrade branch from 7960f7a to d7a9d39 Compare July 31, 2026 11:06
kopernic-pl and others added 2 commits July 31, 2026 13:11
import.meta.dirname is only available from Node 18.20 / 20.11 / 21.2,
but the repo engines field allows ^18.18. Use fileURLToPath(new URL('.', import.meta.url))
which works across all ESM-capable Node versions and is stable across rebases.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…on; simplify readFileDescriptor

Replace no-unsafe-enum-comparison suppression comments in junit.ts and
markdown.ts with Number() coercion that makes the intent clear and
satisfies the linter properly. Remove dead Buffer branch in
readFileDescriptor since setEncoding guarantees string chunks.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 58 out of 62 changed files in this pull request and generated no new comments.

Suppressed comments (1)

packages/rulesets/src/shared/functions/serverVariables/index.ts:110

  • The variable property types were changed to optional (enum?:, default?:), but the branching logic still uses 'enum' in variable / 'default' in variable combined with non-null assertions. This treats { enum: undefined } / { default: undefined } as present and can push undefined into variablePairs or call checkVariableEnumValues with a non-array, which can lead to runtime errors if inputs are constructed programmatically (not via JSON) or invariants change. Prefer value-based guards (Array.isArray, typeof === 'string') and avoid ! here.

@kopernic-pl kopernic-pl added dependencies Pull requests that update a dependency file and removed c/security labels Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants