Skip to content

Fix watch asset validation and errors - #317

Merged
rekmarks merged 2 commits into
developfrom
fix-watchAsset-errors
Dec 2, 2020
Merged

rekmarks merged 2 commits into
developfrom
fix-watchAsset-errors

Conversation

@rekmarks

@rekmarks rekmarks commented Dec 1, 2020

Copy link
Copy Markdown
Contributor

This PR robustifies the watchAsset type checks and returns appropriate RPC errors.

@rekmarks
rekmarks requested a review from a team as a code owner December 1, 2020 22:56
Comment thread src/util.ts

@estebanmino estebanmino 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.

thanks!

@rekmarks
rekmarks merged commit ed077cd into develop Dec 2, 2020
@rekmarks
rekmarks deleted the fix-watchAsset-errors branch December 2, 2020 16:17
Mrtenz pushed a commit that referenced this pull request Oct 16, 2025
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 -->
Naz-Ovh pushed a commit to 0x-fork/metamask-core that referenced this pull request Sep 13, 2026
…k#318)

Top of stack MetaMask#315, on MetaMask#317.

| Dep | From | To |
| --- | --- | --- |
| `typedoc` | `^0.23.15` | `^0.25.13` |
| `@lavamoat/preinstall-always-fail` | `^1.0.0` | `^2.1.0` |
| `jest-when` | `^3.6.0` | `^3.7.0` |

The typedoc bump fixes a live break. typedoc 0.23 caps at TypeScript
5.0, so once MetaMask#311 moved us to `~5.3.3`, `yarn build:docs` crashed with
`Cannot read properties of undefined (reading 'name')`. Nothing caught
it because PR CI never runs `build:docs`, only the docs publish workflow
does.

Also `.nvmrc` `v18` to `lts/*`, and `@ts-bridge/*` added to
`npmPreapprovedPackages`. Both match core.

Left alone on purpose:

- `oxfmt` stays at `^0.44.0` even though
`@metamask/auto-changelog@6.2.1` peer requests `^0.45.0`. Core pins the
same pair, so bumping would diverge from it.


<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Dev-only dependency and Node version pin changes; no runtime library
or security-sensitive application logic is modified.
> 
> **Overview**
> Aligns **dev tooling** with MetaMask core: bumps **`typedoc`** to
`^0.25.13` (and lockfile transitive deps like `marked`, `shiki`,
`minimatch`) so **`yarn build:docs`** works with **`typescript
~5.3.3`**—older typedoc only supported TS ≤5.0 and was failing at doc
generation.
> 
> Also updates **`@lavamoat/preinstall-always-fail`** to `^2.1.0` and
**`jest-when`** to `^3.7.0`, and switches **`.nvmrc`** from `v18` to
**`lts/*`** so local Node tracks current LTS like core.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
654f1e29169b87c50b78f916d2ae5cef30bca178. 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