Skip to content

Remove jsdom, fix lockfile - #314

Merged
rekmarks merged 2 commits into
developfrom
lockfile-fix
Nov 19, 2020
Merged

rekmarks merged 2 commits into
developfrom
lockfile-fix

Conversation

@rekmarks

@rekmarks rekmarks commented Nov 19, 2020 •

Copy link
Copy Markdown
Contributor

Remove jsdom as explicit dependency (it's brought in by others), and fix the lockfile, which needed updating.

[1/4] Resolving packages...
success Already up-to-date.
Done in 0.39s. to fix lockfile
@rekmarks
rekmarks requested a review from a team as a code owner November 19, 2020 17:36
@rekmarks rekmarks changed the title Fix lockfile Remove jsdom, fix lockfile Nov 19, 2020

@Gudahtt Gudahtt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

@rekmarks
rekmarks merged commit ade365d into develop Nov 19, 2020
@rekmarks
rekmarks deleted the lockfile-fix branch November 19, 2020 18:23
Mrtenz pushed a commit that referenced this pull request Oct 16, 2025
Mrtenz pushed a commit to Mrtenz/core that referenced this pull request Jun 17, 2026
Naz-Ovh pushed a commit to 0x-fork/metamask-core that referenced this pull request Sep 13, 2026
Bottom of stack MetaMask#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:misc` switches from Prettier to `oxfmt --ignore-path .gitignore`
- Adds `.oxfmtrc.json`, copied from core
- Turns off `prettier/prettier` and `import/order`, same as core
- Drops `prettier-plugin-packagejson`, replaced by Oxfmt's
`sortPackageJson`

Prettier itself stays, and moves to core's versions, because
`@metamask/eslint-config@15` peer requires all three:

| Dep | From | To |
| --- | --- | --- |
| `prettier` | `^2.7.1` | `^3.3.3` |
| `eslint-config-prettier` | `^8.8.0` | `^9.1.0` |
| `eslint-plugin-prettier` | `^4.2.1` | `^5.2.1` |

Reformatting touches `README.md`, `src/json.ts` and
`src/__fixtures__/bytes.ts`. No content changes.
Naz-Ovh pushed a commit to 0x-fork/metamask-core that referenced this pull request Sep 13, 2026
)

Stacked on MetaMask#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
4fb3fb67cedaefd87b9ece83cc53286a2bce1e82. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
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.

2 participants