Skip to content

chore: Upgrade eslint from v9.x to v10.x#5005

Open
seanrmilligan wants to merge 10 commits into
mongodb:mainfrom
seanrmilligan:sean.milligan/lint
Open

chore: Upgrade eslint from v9.x to v10.x#5005
seanrmilligan wants to merge 10 commits into
mongodb:mainfrom
seanrmilligan:sean.milligan/lint

Conversation

@seanrmilligan

@seanrmilligan seanrmilligan commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Description

Summary of Changes

Migrate the existing lint config:

  • create new eslint.config.mjs
    • npx @eslint/migrate-config .eslintrc.json
  • install relevant updates to resolve peer dependencies
    • npm install globals @eslint/js @eslint/eslintrc -D
    • (and more as necessary)
  • rm .eslintignore (it was folded into the new eslint.config.mjs

Fix new eslint v10.x violations:

  • npm run fix:eslint
  • several manual resolutions (shown as separate commits per error type in this PR)

Double check the following

  • Lint is passing (npm run check:lint)
    • golly is it ever!
  • Self-review completed using the steps outlined here
  • PR title follows the correct format: type(NODE-xxxx)[!]: description
    • Example: feat(NODE-1234)!: rewriting everything in coffeescript
  • Changes are covered by tests
  • New TODOs have a related JIRA ticket

@seanrmilligan
seanrmilligan marked this pull request as ready for review July 15, 2026 23:28
@seanrmilligan
seanrmilligan requested a review from a team as a code owner July 15, 2026 23:28
Copilot AI review requested due to automatic review settings July 15, 2026 23:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 toolchain from ESLint v9 to v10 by migrating to the new flat config format (eslint.config.mjs), updating related devDependencies/scripts, and applying the auto-fixable formatting changes required to satisfy the new lint rules across src/, test/, and etc/.

Changes:

  • Migrate ESLint configuration to flat config (eslint.config.mjs) and fold .eslintignore behavior into config ignores.
  • Upgrade ESLint and related plugins/config packages in package.json / package-lock.json, and update lint scripts accordingly.
  • Apply widespread formatting/cleanup changes to satisfy ESLint v10 (mostly whitespace/typing tweaks), plus a few small refactors.

Reviewed changes

Copilot reviewed 93 out of 96 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/unit/tools/unifed-utils.test.ts Lint-driven spacing adjustment
test/unit/timeout.test.ts Lint-driven spacing adjustment
test/unit/sdam/topology.test.ts Lint refactor; introduces a test logic bug (see comments)
test/unit/sdam/server_selection.test.ts Lint-driven spacing adjustment
test/unit/sdam/server_description.test.ts Lint-driven spacing adjustment
test/unit/sdam/monitor.test.ts Lint-driven spacing adjustment
test/unit/operations/list_collections.test.js Lint-driven spacing adjustment
test/unit/operations/indexes.test.ts Lint-driven spacing adjustment
test/unit/operations/client_bulk_write/command_builder.test.ts Lint-driven spacing adjustment
test/unit/operations/aggregate.test.ts Lint-driven spacing adjustment
test/unit/mongo_logger.test.ts Lint-driven spacing adjustment + comment formatting
test/unit/mongo_client.test.ts Lint-driven spacing adjustment
test/unit/error.test.ts Lint-driven spacing adjustment
test/unit/cursor/aggregation_cursor.test.ts Lint-driven spacing adjustment
test/unit/connection_string.test.ts Lint-driven spacing adjustment
test/unit/commands.test.ts Lint-driven spacing adjustment
test/unit/cmap/stream_description.test.js Remove now-unneeded eslint disables + spacing
test/unit/cmap/handshake/client_metadata.test.ts Lint-driven spacing adjustment
test/unit/cmap/connection_pool_events.test.ts Lint-driven spacing adjustment
test/unit/client-side-encryption/providers/credentialsProvider.test.ts Lint-driven spacing adjustment
test/unit/client-side-encryption/errors.test.ts Lint-driven spacing adjustment
test/unit/client-side-encryption/client_encryption.test.ts Lint-driven spacing adjustment
test/unit/change_stream.test.ts Lint-driven spacing adjustment
test/unit/assorted/sessions_collection.test.js Lint-driven spacing adjustment
test/unit/assorted/sessions_client.test.js Lint-driven spacing adjustment
test/unit/assorted/collations.test.js Lint-driven spacing adjustment
test/types/sessions.test-d.ts Update tsd test typing to satisfy lint/type rules
test/tools/unified-spec-runner/schema.ts Type formatting simplification
test/tools/mongodb-mock/src/server.js Formatting of bitwise expressions
test/mongodb_bundled.ts Use Error(..., { cause }) for improved error chaining
test/manual/tls_support.test.ts Lint-driven spacing adjustment
test/lambda/mongodb/app.mjs Disable no-console; simplify handler JSDoc/signature
test/integration/transactions/transactions.test.ts Lint-driven spacing adjustment
test/integration/sessions/sessions.test.ts Lint-driven spacing adjustment
test/integration/server-discovery-and-monitoring/topology_description.test.ts Lint-driven spacing adjustment
test/integration/server-discovery-and-monitoring/server_discovery_and_monitoring.prose.test.ts Lint-driven spacing adjustment
test/integration/retryable-writes/retryable_writes.spec.test.ts Lint-driven spacing adjustment
test/integration/retryable-writes/non-server-retryable_writes.test.ts Lint-driven spacing adjustment
test/integration/read-write-concern/write_concern.test.ts Lint-driven spacing adjustment
test/integration/node-specific/resource_clean_up.test.ts Lint-driven spacing adjustment
test/integration/node-specific/mongo_client.test.ts Lint-driven spacing adjustment
test/integration/node-specific/cursor_async_iterator.test.js Lint-driven spacing adjustment
test/integration/node-specific/client_encryption.test.ts Lint-driven spacing adjustment
test/integration/node-specific/bson-options/utf8_validation.test.ts Cleanup unused client variable/close logic + spacing
test/integration/node-specific/bson-options/use_bigint_64.test.ts Lint-driven spacing adjustment
test/integration/node-specific/auto_encrypter.test.ts Lint-driven spacing adjustment
test/integration/node-specific/abstract_cursor.test.ts Lint-driven spacing adjustment
test/integration/node-specific/abort_signal.test.ts Remove unused cursor variable/cleanup
test/integration/mongodb-handshake/mongodb-handshake.test.ts Lint-driven spacing adjustment
test/integration/mongodb-handshake/mongodb-handshake.prose.test.ts Lint-driven spacing adjustment
test/integration/index_management.test.ts Lint-driven spacing adjustment
test/integration/crud/misc_cursors.test.ts Minor refactor (left const) + spacing
test/integration/crud/bulk.test.ts Minor refactor (bulk const) + spacing
test/integration/connections-survive-step-down/connections_survive_step_down.prose.test.ts Lint-driven spacing adjustment
test/integration/connection-monitoring-and-pooling/rtt_pinger.test.ts Lint-driven spacing adjustment
test/integration/connection-monitoring-and-pooling/connection.test.ts Remove unused testClient close logic
test/integration/connection-monitoring-and-pooling/connection_pool.test.ts Remove unused Db usage/import + spacing
test/integration/command-logging-and-monitoring/command_logging_and_monitoring.prose.test.ts Lint-driven spacing adjustment
test/integration/client-side-operations-timeout/node_csot.test.ts Lint-driven spacing adjustment
test/integration/client-side-operations-timeout/client_side_operations_timeout.prose.test.ts Lint-driven spacing adjustment
test/integration/client-side-encryption/driver.test.ts Lint-driven spacing adjustment
test/integration/client-side-encryption/client_side_encryption.prose.test.ts Lint-driven spacing adjustment
src/utils.ts Type formatting + loop formatting tweak
src/sort.ts Type formatting simplification
src/sdam/topology.ts Minor refactor of auth() overload handling + formatting
src/sdam/monitor.ts Interface formatting change
src/operations/list_collections.ts Interface formatting change
src/operations/indexes.ts Type/interface formatting change
src/operations/find.ts Interface formatting change
src/operations/command.ts Interface formatting change
src/mongo_types.ts Type formatting changes
src/mongo_logger.ts Type annotation tweak for local variable
src/mongo_client.ts Interface formatting change
src/deps.ts Simplify optional dependency loader return path
src/db.ts Generic constraint formatting
src/cursor/list_collections_cursor.ts Generic constraint formatting
src/cursor/client_bulk_write_cursor.ts Interface formatting change
src/cursor/abstract_cursor.ts Class generic formatting
src/connection_string.ts Formatting-only change to option validator
src/cmap/connection.ts Local variable initialization cleanup
src/cmap/commands.ts Remove unused index update
src/cmap/auth/scram.ts Preserve original error via cause when in FIPS mode
src/cmap/auth/mongodb_aws.ts Import ordering adjustment
src/client-side-encryption/client_encryption.ts map() formatting change
src/change_stream.ts Interface/type formatting changes
src/bulk/common.ts Union type formatting simplification
src/bson.ts Interface formatting change
package.json Upgrade ESLint to v10 + related deps; update lint scripts for flat config
package-lock.json Lockfile updates for upgraded lint toolchain
etc/sdam_viz.js Format long require destructuring
etc/docs/template/static/s/js/searchtools.js Large formatting-only pass (prettier/lint)
etc/docs/template/static/s/js/frontpage.js Formatting-only pass (prettier/lint)
etc/crawfish.mjs Import ordering change
eslint.config.mjs New flat ESLint config (requires fixes; see comments)
.eslintignore Removed (replaced by flat-config ignores)

Comment on lines 102 to 106
mockServer.setMessageHandler(request => {
const doc = request.document;

let initialHelloSent = false;
const initialHelloSent = false;
if (isHello(doc) && !initialHelloSent) {
Comment thread eslint.config.mjs
Comment on lines +190 to +197
{
files: ['**/*.mjs'],

languageOptions: {
ecmaVersion: 5,
sourceType: 'module'
}
},
Comment thread eslint.config.mjs
Comment on lines +235 to +238
'no-console': 'off',
'no-restricted-syntax': 'off',
'typescript-eslint/ban-ts-comment': 'off',
'no-restricted-imports': 'off',
Comment thread src/sdam/topology.ts
}

auth(credentials?: MongoCredentials, callback?: Callback): void {
if (typeof credentials === 'function') ((callback = credentials), (credentials = undefined));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

omg callback code in 2026 😨

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.

3 participants