chore(deps): upgrade ESLint 8 → 10 with flat config migration - #3021
chore(deps): upgrade ESLint 8 → 10 with flat config migration#3021kopernic-pl wants to merge 16 commits into
Conversation
There was a problem hiding this comment.
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 replaceeslint-plugin-importwitheslint-plugin-import-x. - Migrate from
.eslintrc/.eslintignoretoeslint.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.
7960f7a to
d7a9d39
Compare
There was a problem hiding this comment.
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 variablecombined with non-null assertions. This treats{ enum: undefined }/{ default: undefined }as present and can pushundefinedintovariablePairsor callcheckVariableEnumValueswith 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.
- 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>
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>
a1b054f to
e13dfa9
Compare
|
@copilot resolve the merge conflicts in this pull request |
…conflict Co-authored-by: kopernic-pl <3717613+kopernic-pl@users.noreply.github.com>
Merged |
…t it's overriden in tests violations shall be fixed in the separate PR
…ore/eslint-10-upgrade
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 63 out of 66 changed files in this pull request and generated no new comments.
Suppressed comments (2)
packages/functions/src/schema/ajv.ts:92
- This still relies on non-null assertions (
...get(ajv)!/...get(schema)!), which will now be reported by@typescript-eslint/no-non-null-assertion. Since the WeakMaps are initialized locally, this can be rewritten to be assertion-free and avoid double-compiling.
packages/functions/src/schema/index.ts:38 - This reintroduces a
!non-null assertion (previously suppressed). Since you justsetthe map entry, you can avoid both the non-null assertion and the ESLint warning by using a small initialization block instead of chainingset(...).get(...)!.
Summary
^8.22.0to^10.0.0.eslintrc+.eslintignoreto flat config (eslint.config.mjs)@typescript-eslint/eslint-pluginand@typescript-eslint/parserfrom v5 to v8eslint-plugin-importwitheslint-plugin-import-x(maintained fork with ESLint 10 support)eslint-plugin-prettierv4 → v5 andprettierv2 → v3globalspackage (replacesenv:declarations in flat config).eslintrcand.eslintignore; adds.prettierignorefor prettier scriptsBreaking changes handled
@typescript-eslint/no-throw-literal→only-throw-errorcamelcase,ban-ts-ignore,ban-typesno-var-requires→no-require-importseslint-plugin-importwitheslint-plugin-import-x(context.getFilenamewas removed in ESLint 10)/* eslint-env */comments (not supported in flat config)ruleset-bundler/src/loader/common/utils.tsthat TypeScript 4.7 requires but 4.9 infers automaticallyTest plan
yarn lint.eslint— 0 errors, 37 warnings (all pre-existing)yarn build— passesyarn test.jest— 199/200 suites pass (1 pre-existing unrelated failure inruleset-migratorfixture, present ondevelopbefore this change)