1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 03:12:42 +02:00
Commit Graph

115 Commits

Author SHA1 Message Date
Erik Marks
76a2a9bb8b
@metamask/eslint config@5.0.0 (#10358)
* @metamask/eslint-config@5.0.0
* Update eslintrc and prettierrc
* yarn lint:fix
2021-02-04 10:15:23 -08:00
Mark Stacey
86fba2dac1
Fix contentscript injection failure on Firefox 56 (#10034)
On Firefox 56 and Waterfox Classic, our `runLockdown.js` script throws
an error. This is fine on the HTML pages, as the next script tags still
get run without issue (though they don't benefit from the SES lockdown
sadly). But in the `contentscript`, an exception thrown here appears to
halt the execution of subsequent scripts.

To prevent the `contentscript` from crashing completely, lockdown
errors are now caught and logged. They are also logged to Sentry on the
pages where Sentry is setup.
2020-12-10 14:03:04 -03:30
Mark Stacey
b1b6d7ae38
Fix intermittent metrics e2e test failure (#9980)
The metrics e2e test would fail if the segment events still weren't
dispatched when the page loaded. The Segment events are sent on a set
interval, so it isn't abnormal for them to lag behind the page load
itself. The `waitUntilCalled` utility has been used to wait until all
required events have been dispatched.

The `wait-until-called` module was converted to an ES5 module, so that
it could be used from an e2e test. The optional `callCount` parameter
has also been added, to allow waiting for more than one call.

The `segmentSpy` had to be converted to a `segmentStub`, to allow the
`waitUntilCalled` utility to be used.
2020-12-03 14:30:50 -03:30
Brad Decker
2ebf8756a4
[RFC] add prettier to eslint (#8595) 2020-11-02 17:41:28 -06:00
Whymarrh Whitby
80e2a4496e
Fix mocha/max-top-level-suites issues (#9699)
Refs #9663

This change enables `mocha/max-top-level-suites` and fixes the issues raised by the rule.
2020-10-23 16:19:49 -02:30
Whymarrh Whitby
10227266f9
Fix node/no-unsupported-features/node-builtins issues (#9684)
Refs #9663

See [`node/no-unsupported-features/node-builtins`][1] for more information.

This change enables `node/no-unsupported-features/node-builtins` and fixes the issue
raised by the rule.

The `engines.node` version is updated to reflect the version specified by the `.nvmrc`
file and the version used by CircleCI:

```bash
$ cat .nvmrc
v10.18.1
```

```bash
$ docker run --rm -it circleci/node@sha256:e16740707de2ebed45c05d507f33ef204902349c7356d720610b5ec6a35d3d88 node --version
v10.18.1
```
2020-10-22 16:24:57 -02:30
Whymarrh Whitby
6038a1f3f5
Fix dot-notation issues (#9679)
Refs #9663

This change enables `dot-notation` and fixes the issues raised by the rule.
2020-10-22 14:37:02 -02:30
Whymarrh Whitby
6df17dc90e
Fix accessor-pairs issues (#9680)
Refs #9663

See [`accessor-pairs`][1] for more information.

This change enables `accessor-pairs` and fixes the issues raised by the rule.

  [1]:https://eslint.org/docs/rules/accessor-pairs
2020-10-22 14:36:44 -02:30
Whymarrh Whitby
362e717eef
Fix node/no-deprecated-api issues (#9670)
Refs #9663

See [`node/no-deprecated-api`][1] for more information.

This change enables `node/no-deprecated-api` and fixes the issues raised by the rule.

  [1]:https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-deprecated-api.md

The change to the way that `punycode` is imported is to address the fact that
third-party module is hidden by the built-in. This is a silly hack but it works.
2020-10-22 11:33:45 -02:30
Whymarrh Whitby
b704eaeb66
Fix node/no-path-concat issues (#9669)
Refs #9663

See [`node/no-path-concat`][1] for more information.

This change enables `node/no-path-concat` and fixes the issues raised by the rule.

  [1]:https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-path-concat.md
2020-10-22 00:04:52 -02:30
Whymarrh Whitby
b369a68eb3
Fix node/no-callback-literal issues (#9668)
Refs #9663

See [`node/no-callback-literal`][1] for more information.

This change enables `node/no-callback-literal` and fixes the issues raised by the rule.

  [1]:https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-callback-literal.md
2020-10-21 15:54:51 -02:30
Mark Stacey
7d0a7ab301
Update @metamask/eslint-config to v4.1.0 (#9663)
`@metamask/eslint-config` has been updated to v4.1.0. This update
requires that we update `eslint` to v7 as well, which in turn requires
updating most `eslint`-related packages.

Most notably, `babel-eslint` was replaced with `@babel/eslint-parser`,
and `babel-eslint-plugin` was replaced by `@babel/eslint-plugin`. This
required renaming all the `babel/*` rules to `@babel/*`.

Most new or updated rules that resulted in lint errors have been
temporarily disabled. They will be fixed and re-enabled in subsequent
PRs.
2020-10-21 14:01:03 -02:30
Mark Stacey
ce66ddcf0d
Use prettier for JSON linting (#9396)
Instead of using `eslint-plugin-json` for linting JSON files,
`prettier` is now used. `prettier` is capable of detecting and
correcting more problems than `eslint-plugin-json` can, such as
indentation.

All JSON files have been run through `prettier`. The changes are all
superficial.
2020-09-11 10:57:39 -03:00
Whymarrh Whitby
b8938c9c7a
Move ESLint ignore patterns into config (#9392) 2020-09-10 14:35:29 -02:30
Whymarrh Whitby
449118dfc9
Remove unneeded globals from ESLint config (#9342) 2020-09-02 12:38:11 -02:30
Whymarrh Whitby
1024f49275
Use @metamask/eslint-config@3.2.0 (#9330) 2020-08-31 13:11:15 -02:30
Whymarrh Whitby
2b7a692658
Use @metamask/eslint-config@3.1.0 (#9275)
This change updates the shared ESLint config to the latest published version,
v3.1.0.

From the config [`CHANGELOG.md`][1]: v3.0.1 has disabled `prefer-object-spread`
by default, so it has been enabled for this project.

  [1]:https://github.com/MetaMask/eslint-config/blob/master/CHANGELOG.md
2020-08-19 17:34:58 -02:30
Whymarrh Whitby
b6ccd22d6c
Update ESLint shared config to v3 (#9274)
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-08-19 13:57:05 -02:30
Whymarrh Whitby
6ab12001e3
Fix prefer-destructuring issues (#9263)
See [`prefer-destructuring`](https://eslint.org/docs/rules/prefer-destructuring) for more information.

This change enables `prefer-destructuring` and fixes the issues raised by the rule.
2020-08-18 17:36:58 -02:30
Whymarrh Whitby
c1e3c229bc
Fix import/order issues (#9239)
See [`import/order`](https://eslint.org/docs/rules/import/order) for more information.

This change enables `import/order` and fixes the issues raised by the rule.
2020-08-18 16:48:25 -02:30
Whymarrh Whitby
b7259e5d6a
Fix radix issues (#9247)
See [`radix`](https://eslint.org/docs/rules/radix) for more information.

This change enables `radix` and fixes the issues raised by the rule.
2020-08-18 16:38:22 -02:30
Whymarrh Whitby
4357cda7b8
Fix no-shadow issues (#9246)
See [`no-shadow`](https://eslint.org/docs/rules/no-shadow) for more information.

This change enables `no-shadow` and fixes the issues raised by the rule.
2020-08-18 14:06:45 -02:30
Whymarrh Whitby
a89b6677a1
Fix import/unambiguous issues (#9233)
See [`import/unambiguous`](https://eslint.org/docs/rules/import/unambiguous) for more information.

This change enables `import/unambiguous` and fixes the issues raised by the rule.
2020-08-17 13:51:01 -02:30
Whymarrh Whitby
e803807dd9
Fix no-param-reassign issues (#9235)
See [`no-param-reassign`](https://eslint.org/docs/rules/no-param-reassign) for more information.

This change enables `no-param-reassign` and fixes the issues raised by the rule.
2020-08-15 09:28:11 -02:30
Whymarrh Whitby
aaacf66c6e
Fix import/no-extraneous-dependencies issues (#9232)
See [`import/no-extraneous-dependencies`](https://eslint.org/docs/rules/import/no-extraneous-dependencies) for more information.

This change enables `import/no-extraneous-dependencies` and fixes the issues raised by the rule.
2020-08-14 17:34:56 -02:30
Whymarrh Whitby
e021acdc0a
Fix max-statements-per-line issues (#9218)
See [`max-statements-per-line`](https://eslint.org/docs/rules/max-statements-per-line) for more information.

This change enables `max-statements-per-line` and fixes the issues raised by the rule.
2020-08-14 15:13:56 -02:30
Whymarrh Whitby
9e7841fa91
Consolidate ESLint config files (#9231) 2020-08-14 13:41:25 -02:30
Whymarrh Whitby
5d42a9b773
Fix require-unicode-regexp issues (#9212)
* Fix require-unicode-regexp issues

See [`require-unicode-regexp`](https://eslint.org/docs/rules/require-unicode-regexp) for more information.

This change enables `require-unicode-regexp` and fixes the issues raised by the rule.

* Remove case-insensitive flag from regexps
2020-08-14 09:18:42 -02:30
Whymarrh Whitby
884775cf71
Fix no-negated-condition issues (#9222)
See [`no-negated-condition`](https://eslint.org/docs/rules/no-negated-condition) for more information.

This change enables `no-negated-condition` and fixes the issues raised by the rule.
2020-08-14 09:17:43 -02:30
Whymarrh Whitby
c11888f287
Fix no-empty-function issues (#9216)
See [`no-empty-function`](https://eslint.org/docs/rules/no-empty-function) for more information.

This change enables `no-empty-function` and fixes the issues raised by the rule.
2020-08-14 09:17:02 -02:30
Whymarrh Whitby
9b78d3ab07
Fix import/extensions issues (#9217)
See [`import/extensions`](https://eslint.org/docs/rules/import/extensions) for more information.

This change enables `import/extensions` and fixes the issues raised by the rule.
2020-08-14 09:16:45 -02:30
Whymarrh Whitby
3bd22a2058
Fix no-template-curly-in-string issues (#9221)
See [`no-template-curly-in-string`](https://eslint.org/docs/rules/no-template-curly-in-string) for more information.

This change enables `no-template-curly-in-string` and fixes the issues raised by the rule.
2020-08-13 19:01:55 -02:30
Whymarrh Whitby
944f6d4880
Fix no-process-exit issues (#9219)
See [`no-process-exit`](https://eslint.org/docs/rules/no-process-exit) for more information.

This change enables `no-process-exit` and fixes the issues raised by the rule.
2020-08-13 19:01:40 -02:30
Whymarrh Whitby
82a0ee27f3
Fix prefer-rest-params issues (#9215)
See [`prefer-rest-params`](https://eslint.org/docs/rules/prefer-rest-params) for more information.

This change enables `prefer-rest-params` and fixes the issues raised by the rule.
2020-08-13 18:05:18 -02:30
Whymarrh Whitby
146127c474
Fix no-prototype-builtins issues (#9213)
See [`no-prototype-builtins`](https://eslint.org/docs/rules/no-prototype-builtins) for more information.

This change enables `no-prototype-builtins` and fixes the issues raised by the rule.
2020-08-13 18:04:51 -02:30
Whymarrh Whitby
b91cf74d14
Fix no-nested-ternary issues (#9214)
See [`no-nested-ternary`](https://eslint.org/docs/rules/no-nested-ternary) for more information.

This change enables `no-nested-ternary` and fixes the issues raised by the rule.
2020-08-13 17:30:09 -02:30
Whymarrh Whitby
954df6e482
Fix no-constant-condition issues (#9210)
See [`no-constant-condition`](https://eslint.org/docs/rules/no-constant-condition) for more information.

This change enables `no-constant-condition` and fixes the issues raised by the rule.
2020-08-12 22:09:17 -02:30
Whymarrh Whitby
42e7d205b2
Fix no-dupe-else-if issues (#9208)
See [`no-dupe-else-if`](https://eslint.org/docs/rules/no-dupe-else-if) for more information.

This change enables `no-dupe-else-if` and fixes the issues raised by the rule.
2020-08-12 21:22:02 -02:30
Whymarrh Whitby
853b89e314
Fix no-global-assign issues (#9209)
See [`no-global-assign`](https://eslint.org/docs/rules/no-global-assign) for more information.

This change enables `no-global-assign` and fixes the issues raised by the rule.
2020-08-12 21:21:54 -02:30
Whymarrh Whitby
cd370be728
Fix no-invalid-this issues (#9207)
See [`no-invalid-this`](https://eslint.org/docs/rules/no-invalid-this) for more information.

This change enables `no-invalid-this` and fixes the issues raised by the rule.
2020-08-12 21:19:33 -02:30
Whymarrh Whitby
c0f05ccae6
Fix implicit-arrow-linebreak issues (#9201)
See [`implicit-arrow-linebreak`](https://eslint.org/docs/rules/implicit-arrow-linebreak) for more information.

This change enables `implicit-arrow-linebreak` and fixes the issues raised by the rule.
2020-08-12 21:19:10 -02:30
Whymarrh Whitby
76bd7f98b6
Fix prefer-spread issues (#9203)
See [`prefer-spread`](https://eslint.org/docs/rules/prefer-spread) for more information.

This change enables `prefer-spread` and fixes the issues raised by the rule.
2020-08-12 20:42:07 -02:30
Whymarrh Whitby
310b15ba4a
Fix no-plusplus issues (#9206)
See [`no-plusplus`](https://eslint.org/docs/rules/no-plusplus) for more information.

This change enables `no-plusplus` and fixes the issues raised by the rule.
2020-08-12 20:36:44 -02:30
Whymarrh Whitby
548b0bbbd5
Fix no-eq-null issues (#9205)
See [`no-eq-null`](https://eslint.org/docs/rules/no-eq-null) for more information.

This change enables `no-eq-null` and fixes the issues raised by the rule.
2020-08-12 20:32:44 -02:30
Whymarrh Whitby
88f54e29fb
Fix no-empty issues (#9202)
See [`no-empty`](https://eslint.org/docs/rules/no-empty) for more information.

This change enables `no-empty` and fixes the issues raised by the rule.
2020-08-12 18:20:29 -02:30
Whymarrh Whitby
3346c2fc07
Fix no-loop-func issues (#9199)
See [`no-loop-func`](https://eslint.org/docs/rules/no-loop-func) for more information.

This change enables `no-loop-func` and fixes the issues raised by the rule.
2020-08-12 17:29:14 -02:30
Whymarrh Whitby
ef88d79fac
Fix no-useless-concat issues (#9200)
See [`no-useless-concat`](https://eslint.org/docs/rules/no-useless-concat) for more information.

This change enables `no-useless-concat` and fixes the issues raised by the rule.
2020-08-12 17:07:44 -02:30
Whymarrh Whitby
9842b2f1ce
Fix no-useless-catch issues (#9198)
See [`no-useless-catch`](https://eslint.org/docs/rules/no-useless-catch) for more information.

This change enables `no-useless-catch` and fixes the issues raised by the rule.
2020-08-12 16:37:15 -02:30
Whymarrh Whitby
a8863a3446
Fix consistent-return issues (#9192)
See [`consistent-return`](https://eslint.org/docs/rules/consistent-return) for more information.

This change enables `consistent-return` and fixes the issues raised by the rule.
2020-08-12 16:36:57 -02:30
Whymarrh Whitby
885125ad03
Fix no-case-declarations issues (#9191)
See [`no-case-declarations`](https://eslint.org/docs/rules/no-case-declarations) for more information.

This change enables `no-case-declarations` and fixes the issues raised by the rule.
2020-08-12 14:11:27 -02:30
Whymarrh Whitby
bf6578c6b8
Enable guard-for-in rule (#9000) 2020-07-21 18:40:45 -02:30
Whymarrh Whitby
50c4db73cf
Fix global-require issues (#8999) 2020-07-17 21:06:29 -02:30
Whymarrh Whitby
68a64af5b3
Fix callback-return issues (#8996)
See [`callback-return`](https://eslint.org/docs/rules/callback-return) for more information.

This change enables `callback-return` and fixes the resulting issues.
2020-07-17 20:19:52 -02:30
Whymarrh Whitby
983e32274c Fix array-callback-return issues
See [`array-callback-return`](https://eslint.org/docs/rules/array-callback-return) for more information.

This change enables `array-callback-return` and fixes the issues raised by the
rule.
2020-07-17 16:03:33 -02:30
Brad Decker
13d6803698
Adds the rule of hooks eslint rule (#8779) 2020-06-10 13:31:14 -05:00
Whymarrh Whitby
e4b8cddf02
Disallow all anonymous default export, aside from CSF and migrations (#8535)
CSF = Storybook’s Component Story Format (CSF)

See https://storybook.js.org/docs/formats/component-story-format/

Note that the migrations still use CommonJS require, so the default export as
an object is quite ergonomic (& I don't want to touch the migrations).
2020-05-18 21:18:11 -02:30
Whymarrh Whitby
c7f866c06f
Add no-tabs ESLint rule (#8518) 2020-05-05 18:35:12 -02:30
Mark Stacey
5ee1291662
Prevent accidental use of globals (#8340)
Previously all browser globals were allowed to be used anywhere by
ESLint because we had set the `env` property to `browser` in the ESLint
config. This has made it easy to accidentally use browser globals
(e.g. #8338), so it has been removed. Instead we now have a short list
of allowed globals.

All browser globals are now accessed as properties on `window`.

Unfortunately this change resulted in a few different confusing unit
test errors, as some of our unit tests setup assumed that a particular
global would be used via `window` or `global`. In particular,
`window.fetch` didn't work correctly because it wasn't patched by the
AbortController polyfill (only `global.fetch` was being patched).
The `jsdom-global` package we were using complicated matters by setting
all of the JSDOM `window` properties directly on `global`, overwriting
the `AbortController` for example.

The `helpers.js` test setup module has been simplified somewhat by
removing `jsdom-global` and constructing the JSDOM instance manually.
The JSDOM window is set on `window`, and a few properties are set on
`global` as well as needed by various dependencies. `node-fetch` and
the AbortController polyfill/patch now work as expected as well,
though `fetch` is only available on `window` now.
2020-04-15 14:23:27 -03:00
Whymarrh Whitby
6b6615be27
Enable react/jsx-first-prop-new-line for multiline, single prop JSX (#8276)
* Enable react/jsx-first-prop-new-line for multiline, single prop JSX
* yarn lint --fix
2020-04-01 18:08:19 -02:30
Whymarrh Whitby
81d8237654
Use eslint-plugin-react@7.18.3 (#8085) 2020-02-24 15:24:35 -03:30
Whymarrh Whitby
ef8ea9b188
Remove eslint-plugin-chai (#8089) 2020-02-24 14:39:55 -03:30
Whymarrh Whitby
da0300d3b1 Enable core ESLint no-mixed-operators rule 2020-02-17 21:06:36 -03:30
Whymarrh Whitby
a78cf0ef3a Enable arrow-parens ESLint rule 2020-02-15 17:04:21 -03:30
Whymarrh Whitby
4f3fc95d50
Update ESLint rules for test suite (#8023)
* Use @metamask/eslint-config@1.1.0
* Use eslint-plugin-mocha@6.2.2
* Mark root ESLint config as root
* Update Mocha ESLint rules with shared ESLint config
2020-02-11 13:21:13 -03:30
Whymarrh Whitby
ecd4b8221c
Use shared MetaMask ESLint config (#7882) 2020-01-22 11:07:19 -03:30