Stacked on #314.
Replaces `.eslintrc.js` with a flat `eslint.config.mjs` and moves the
ESLint stack to core's versions.
| Dep | From | To |
| --- | --- | --- |
| `eslint` | `^8.44.0` | `^9.39.1` |
| `@metamask/eslint-config{,-jest,-nodejs,-typescript}` | `^12.0.0` |
`^15.0.0` |
| `@metamask/auto-changelog` | `^3.1.0` | `^6.1.0` |
| `eslint-plugin-jest` | `^27.2.2` | `^28.8.3` |
| `eslint-plugin-jsdoc` | `^39.9.1` | `^50.2.4` |
| `eslint-plugin-n` | `^15.7.0` | `^17.10.3` |
| `eslint-plugin-promise` | `^6.1.1` | `^7.1.0` |
Drops `eslint-plugin-import` and
`@typescript-eslint/{parser,eslint-plugin}` for `eslint-plugin-import-x`
and `typescript-eslint`. Adds `@types/semver@^7`, which had been
arriving transitively through `@typescript-eslint/eslint-plugin` and
broke the build once that was removed.
Config v15 surfaced 351 problems v12 never enforced. Stylistic ones are
off with TODO comments, matching core. The rest were stale directives
naming rules that typescript-eslint v8 renamed or removed, so the code
under them was going unchecked:
| Directive | Fate | Sites |
| --- | --- | --- |
| `@typescript-eslint/no-throw-literal` | renamed to `only-throw-error`
| 8 |
| `@typescript-eslint/ban-types` | split in v8, no longer needed here |
3 |
| `import/no-nodejs-modules` | now `import-x/no-nodejs-modules` | 1
block |
| `jest/no-if` | removed in eslint-plugin-jest v28 | 1 |
Two autofixes are reverted because they changed behaviour rather than
style:
1. `hasProperty`'s constraint was rewritten from `Object` to `object`.
The original carried an explicit suppression, so `Object` was
deliberate: it accepts boxed primitives, and narrowing it breaks callers
passing a string or number.
2. `json.test-d.ts` lost `as any` and `as number | undefined` from its
tsd assertions. In type tests the assertion is the test.
`no-unnecessary-type-assertion` is now off for `*.test-d.ts`.
`jsdoc/require-jsdoc` stays off rather than suppressed: its autofixer
inserted 193 empty JSDoc blocks on the first pass. Core disables it for
the same reason.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Large toolchain bump touches most of the repo; export and `toWei`
parsing changes could affect consumers, though runtime logic changes
appear limited and intentional.
>
> **Overview**
> Migrates linting from **`.eslintrc.js` to flat `eslint.config.mjs`**,
bumps **ESLint 8 → 9** and **`@metamask/eslint-config` v12 → v15**, and
swaps **`eslint-plugin-import` / split `@typescript-eslint/*` for
`eslint-plugin-import-x` and `typescript-eslint`**. The **`lint:eslint`
script** drops `--ext js,ts`; **`@types/semver`** is added explicitly
after dropping the old typescript-eslint transitive dep; **LavaMoat**
allows **`eslint-plugin-import-x>unrs-resolver`**.
>
> The new config **turns off several JSDoc rules** (matching core, with
TODOs), **disables `no-unnecessary-type-assertion` for `*.test-d.ts`**,
and **relaxes Node builtin checks in tests** for crypto polyfill
coverage. **`reportUnusedDisableDirectives: 'error'`** forces cleanup of
stale eslint-disable comments across fixtures and tests.
>
> **Source edits** are mostly rule compliance: explicit return types,
renamed disables (`only-throw-error`, `import-x/no-nodejs-modules`),
**`uuid` named import** in `fs.ts`, **`export type *`** for type-only
barrels, and typing tweaks in **`FrozenMap`/`FrozenSet`**. Two **autofix
reversals** preserve behavior: **`hasProperty` keeps `Object`** (boxed
primitives), and type-test assertions stay intact. **`toWei`** now
treats **empty whole/fraction parts** (e.g. `.5`, `5.`) as **`0`**, not
only `undefined`.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
4fb3fb6. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Bottom of stack #315.
Core formats with Oxfmt, so once this package moves into
packages/its files get reformatted anyway. Doing it here keeps that diff reviewable instead of landing as noise on top of the migrated git history.lint:miscswitches from Prettier tooxfmt --ignore-path .gitignore.oxfmtrc.json, copied from coreprettier/prettierandimport/order, same as coreprettier-plugin-packagejson, replaced by Oxfmt'ssortPackageJsonPrettier itself stays, and moves to core's versions, because
@metamask/eslint-config@15peer requires all three:prettier^2.7.1^3.3.3eslint-config-prettier^8.8.0^9.1.0eslint-plugin-prettier^4.2.1^5.2.1Reformatting touches
README.md,src/json.tsandsrc/__fixtures__/bytes.ts. No content changes.