Files
2db78cdcd8 Upgrade ESLint v9 → v10 (+ typescript-eslint 8.65, pnpm catalog cleanup) (#39421)
## Summary

Upgrades the repo from ESLint **v9 → v10** (latest 10.x, resolves
10.8.0) and bumps `typescript-eslint` / `@typescript-eslint/*` from
`~8.60.0` → `~8.65.0`. The repo already uses flat config
(`eslint.config.mjs`) via the internal `@azure/eslint-plugin-azure-sdk`,
so this is a version-bump + compatibility effort, not a config
migration. Follow-up commits tidy up dependency declarations (pnpm
catalog + redundant `@types/*`), address review feedback, and fix the
real-world v10 lint breaks surfaced by CI.

**Repo-wide lint verified:** `turbo lint --continue` across the whole
workspace → **468/468 packages pass, 0 errors** (remaining `✖` are
warnings only — the intentionally-downgraded rules).

ESLint version is controlled centrally by the pnpm catalog in
`pnpm-workspace.yaml`.

## Commit 1 — ESLint v9 → v10 + typescript-eslint 8.65

- **pnpm catalog**: `eslint ^9.39.1 → ^10.x`.
- `@eslint/js ^9 → ^10.0.1`; `eslint-plugin-promise ^7.2.1 → ^7.3.0`
(adds eslint `^10` peer); plugin `peerDependencies.eslint ^9.22.0 →
^10.0.0`.
- `typescript-eslint` / `@typescript-eslint/*` `~8.60.0 → ~8.65.0`
across the plugin, tooling packages, and `samples/frameworks/react/ts`.
- **`eslint-plugin-import` peer blocker** (its latest still caps eslint
at `^9`) resolved via pnpm `peerDependencyRules.allowedVersions` — only
`import/no-extraneous-dependencies` is consumed and it works
functionally under v10 (chosen over switching to
`eslint-plugin-import-x` for lower risk / zero code change).
- **`engines.node`** tightened to `>=22.13` (root) / `>=22.13.0`
(plugin), matching ESLint 10's Node floor.
- **ESLint 10 compat fix** in `src/utils/verifiers.ts`:
`RuleFixer.replaceText` now hard-asserts a string, so a lying `(expected
as string)` cast was replaced with `String(expected)` (2 fixers).
- **3 new v10 `eslint:recommended` rules** (`preserve-caught-error`,
`no-useless-assignment`, `no-unassigned-vars`) downgraded to `"warn"` in
`eslint-customized.ts` with a justification comment, so the bump doesn't
break `lint` repo-wide at once (mirrors the existing `no-param-reassign`
precedent; can be promoted back to `error` after cleanup — tracked in
#39423).

**Validation:** plugin build OK; **vitest 703/703 pass**;
`@azure/storage-queue` lint **0 errors, 51 warnings**.

## Commit 2 — pnpm catalog cleanup + redundant `@types/*` removal

- Move **`@eslint/js`** and **`typescript-eslint`** into the
`pnpm-workspace.yaml` default catalog and reference them via
`"catalog:"` in workspace members (`eslint-plugin-azure-sdk`,
`dev-tool`, `warp`, `vite-plugin-browser-test-map`,
`turborepo-remote-cache`).
- **`eng/tools/ci-runner`** is **not** a pnpm workspace member, so it
keeps **direct** versions (a `catalog:` ref would not resolve there).
The v7-pinned `js-sdk-release-tools` breaking-change-detector is left
untouched.
- Remove 3 redundant `@types/*` devDependencies from
`eslint-plugin-azure-sdk` (`@types/eslint` — which was duplicated in
both `dependencies` and `devDependencies` — plus
`@types/eslint-config-prettier`), now that `eslint@10` and
`eslint-config-prettier@10` ship their own bundled type definitions.

## Commit 3 — review feedback: bump the `eslint` runtime to v10 too

- Two packages had `@eslint/js` bumped to v10 but still declared the
`eslint` **runtime** at `^9`. Fixed: `turborepo-remote-cache` → `eslint:
"catalog:"`; `ci-runner` → direct `eslint: ^10.8.0` (not a workspace
member).
- Catalog `eslint` pinned to the latest 10.x (`^10.8.0`); catalog now
resolves eslint 10.8.0 everywhere.

## Commit 4 — repo-wide lint fix: `no-useless-assignment` in dev-tool

Broad CI linting surfaced one real v10 error the shared `warn` downgrade
did **not** cover: tooling packages (`dev-tool`, `warp`,
`turborepo-remote-cache`, `ci-runner`, and the plugin itself) use
**standalone** `eslint.config.mjs` files that apply `@eslint/js`
`recommended` **directly**, bypassing the shared `eslint-customized.ts`
overrides — so the 3 new rules fire as **errors** there, not warnings.

- Fixed the single violation:
`common/tools/dev-tool/.../checkNodeVersions.ts` dropped a redundant `=
undefined` initializer on `artifactURL` (every code path reassigns or
throws before it's read). Lint + `tsc` both clean.
- Audited every standalone-config package in CI lint scope — `warp`,
`vite-plugin-browser-test-map`, `turborepo-remote-cache`, and
`eslint-plugin-azure-sdk` all lint clean; `dev-tool` was the only error.

## Commit 5 — `no-shadow-restricted-names` now reports `globalThis` (v10
change)

A second CI run surfaced a different v10 behavior change:
`no-shadow-restricted-names`'s `reportGlobalThis` option flipped its
default from `false` → `true`, so it now flags `declare const
globalThis` **ambient TypeScript declarations** (used to narrowly type
`globalThis.*` without pulling in full lib types) as shadowing a
restricted name. This broke `@typespec/ts-http-runtime` lint
(`src/util/uuidUtils.ts` + `uuidUtils-react-native.mts`, 2 errors — the
only two such declarations in the repo).

- Restored the v9 behavior in the shared `eslint-customized.ts` via
`"no-shadow-restricted-names": ["error", { reportGlobalThis: false }]`,
keeping the rest of the rule active (still catches shadowing of `NaN`,
`undefined`, `Infinity`, `eval`, `arguments`). This is the fix ESLint's
own migration guide documents for the ambient-declaration case.

## Notes

- The 3 new v10 recommended rules are intentionally `warn`, not `off`,
for packages on the shared config — they stay visible for later cleanup
(#39423).
- The other `[ELIFECYCLE] Command failed` lines in the CI logs were
turbo fail-fast casualties (different set each run), not independent
errors — confirmed by linting them directly (all pass) and by the
full-repo `turbo lint` (468/468).
- No source/runtime behavior changes beyond the `verifiers.ts` compat
fix and the dev-tool `artifactURL` cleanup; the rest is dependency +
config metadata.

## Commit 6 — review feedback: downgrade the 3 new v10 rules in the
`internal` config too

_Copilot agent :copilot: (on behalf of @jeremymeng):_ Review feedback
surfaced one more path the shared `eslint-customized.ts` warning
downgrades did **not** reach: the `internal` config (in
`src/configs/index.ts`) builds its own array that spreads
`eslint.configs.recommended` but never includes `eslintCustomized`, so
`preserve-caught-error`, `no-useless-assignment`, and
`no-unassigned-vars` stayed as **errors** for consumers of
`configs.internal` (e.g. `sdk/test-utils/recorder`) — contrary to the
repo-wide warning-only migration intent.

- Added the three `"warn"` downgrades directly to the `internal`
config's inline `rules` block so it matches the `recommended` config.
Scoped to just those three rules; no other restructuring.

---------

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: cf6320ed-d2d6-420c-8188-6a63a557ca4b
2026-07-28 15:30:40 -07:00

36 lines
1022 B
JSON

{
"name": "@azure/monorepo",
"version": "0.0.1",
"private": true,
"scripts": {
"build": "turbo build",
"build:test": "turbo run build:test",
"build:samples": "turbo run build:samples",
"clean": "turbo run clean",
"check-format": "turbo run check-format",
"cspell": "cspell --no-progress .",
"format": "turbo run format",
"lint": "turbo run lint",
"lint:fix": "turbo run lint:fix",
"preinstall": "npx only-allow pnpm",
"purge": "rimraf --glob \"sdk/**/node_modules/\"",
"test": "turbo run test",
"test:node": "turbo run test:node",
"test:browser": "turbo run test:browser",
"test:esm": "turbo run test:esm",
"test:vitest": "vitest",
"update-snippets": "turbo run update-snippets"
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.17.4",
"cspell": "^9.6.4",
"prettier-plugin-packagejson": "^2.5.22",
"rimraf": "^6.1.3",
"turbo": "^2.8.9"
},
"engines": {
"node": ">=22.13"
},
"packageManager": "[email protected]"
}