Skip to content

Commit de1029a

Browse files
committed
Merge branch 'main' into feat/add-monad-failover-rpc
2 parents 10e38cf + bc534f9 commit de1029a

File tree

1,411 files changed

+28396
-20708
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,411 files changed

+28396
-20708
lines changed

.depcheckrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ ignores:
8282
- 'path-browserify' # polyfill
8383
- 'nyc' # coverage
8484
- 'core-js-pure' # polyfills
85+
- 'react-compiler-webpack' # build tool
8586
# babel
8687
- '@babel/plugin-transform-logical-assignment-operators'
8788
- 'babel-plugin-react-compiler'

.eslintrc.base.js

Lines changed: 61 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
const path = require('path');
2-
31
module.exports = {
4-
extends: [
5-
'@metamask/eslint-config',
6-
path.resolve(__dirname, '.eslintrc.jsdoc.js'),
7-
],
2+
extends: ['@metamask/eslint-config'],
3+
4+
plugins: ['@metamask/design-tokens'],
85

96
globals: {
107
document: 'readonly',
@@ -15,10 +12,13 @@ module.exports = {
1512
AggregateError: 'readonly',
1613
},
1714

18-
rules: {
19-
// TODO: re-enable once the proposed feature at https://github.com/gajus/eslint-plugin-jsdoc/pull/964#issuecomment-1936470252 is available
20-
'jsdoc/check-line-alignment': 'off',
15+
settings: {
16+
jsdoc: {
17+
mode: 'typescript',
18+
},
19+
},
2120

21+
rules: {
2222
'default-param-last': 'off',
2323
'prefer-object-spread': 'error',
2424
'require-atomic-updates': 'off',
@@ -82,5 +82,57 @@ module.exports = {
8282

8383
// This is necessary to run eslint on Windows and not get a thousand CRLF errors
8484
'prettier/prettier': ['error', { endOfLine: 'auto' }],
85+
86+
'@metamask/design-tokens/color-no-hex': 'error',
87+
'import/no-restricted-paths': [
88+
'error',
89+
{
90+
basePath: './',
91+
zones: [
92+
{
93+
target: './app',
94+
from: './ui',
95+
message:
96+
'Should not import from UI in background, use shared directory instead',
97+
},
98+
{
99+
target: './ui',
100+
from: './app',
101+
message:
102+
'Should not import from background in UI, use shared directory instead',
103+
},
104+
{
105+
target: './shared',
106+
from: './app',
107+
message: 'Should not import from background in shared',
108+
},
109+
{
110+
target: './shared',
111+
from: './ui',
112+
message: 'Should not import from UI in shared',
113+
},
114+
],
115+
},
116+
],
117+
118+
/* JSDoc plugin rules */
119+
120+
// TODO: re-enable once the proposed feature at https://github.com/gajus/eslint-plugin-jsdoc/pull/964#issuecomment-1936470252 is available
121+
'jsdoc/check-line-alignment': 'off',
122+
123+
// Allow tag `jest-environment` to work around Jest bug
124+
// See: https://github.com/facebook/jest/issues/7780
125+
'jsdoc/check-tag-names': ['error', { definedTags: ['jest-environment'] }],
126+
127+
// TODO: Re-enable these
128+
'jsdoc/match-description': 'off',
129+
'jsdoc/require-description': 'off',
130+
'jsdoc/require-jsdoc': 'off',
131+
'jsdoc/require-param-description': 'off',
132+
'jsdoc/require-param-type': 'off',
133+
'jsdoc/require-returns-description': 'off',
134+
'jsdoc/require-returns-type': 'off',
135+
'jsdoc/require-returns': 'off',
136+
'jsdoc/valid-types': 'off',
85137
},
86138
};

.eslintrc.js

Lines changed: 68 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -12,51 +12,15 @@ const tsconfig = ts.parseJsonConfigFileContent(config, ts.sys, './');
1212
*/
1313
module.exports = {
1414
root: true,
15-
// Suggested addition from the storybook 6.5 update
16-
extends: ['plugin:storybook/recommended'],
1715
// Ignore files which are also in .prettierignore
1816
ignorePatterns: readFileSync('.prettierignore', 'utf8').trim().split('\n'),
1917
// eslint's parser, esprima, is not compatible with ESM, so use the babel parser instead
2018
parser: '@babel/eslint-parser',
21-
plugins: ['@metamask/design-tokens'],
22-
rules: {
23-
'@metamask/design-tokens/color-no-hex': 'error',
24-
'import/no-restricted-paths': [
25-
'error',
26-
{
27-
basePath: './',
28-
zones: [
29-
{
30-
target: './app',
31-
from: './ui',
32-
message:
33-
'Should not import from UI in background, use shared directory instead',
34-
},
35-
{
36-
target: './ui',
37-
from: './app',
38-
message:
39-
'Should not import from background in UI, use shared directory instead',
40-
},
41-
{
42-
target: './shared',
43-
from: './app',
44-
message: 'Should not import from background in shared',
45-
},
46-
{
47-
target: './shared',
48-
from: './ui',
49-
message: 'Should not import from UI in shared',
50-
},
51-
],
52-
},
53-
],
54-
},
5519
overrides: [
5620
/**
5721
* == Modules ==
5822
*
59-
* The first two sections here, which cover module syntax, are mutually
23+
* The first three sections here, which cover module syntax, are mutually
6024
* exclusive: the set of files covered between them may NOT overlap. This is
6125
* because we do not allow a file to use two different styles for specifying
6226
* imports and exports (however theoretically possible it may be).
@@ -73,6 +37,8 @@ module.exports = {
7337
'.eslintrc.*.js',
7438
'.mocharc.js',
7539
'*.config.js',
40+
'app/scripts/lockdown-run.js',
41+
'app/scripts/lockdown-more.js',
7642
'development/**/*.js',
7743
'test/e2e/**/*.js',
7844
'test/helpers/*.js',
@@ -112,7 +78,6 @@ module.exports = {
11278
files: [
11379
'app/**/*.js',
11480
'shared/**/*.js',
115-
'shared/**/*.ts',
11681
'ui/**/*.js',
11782
'**/*.test.js',
11883
'test/lib/**/*.js',
@@ -121,6 +86,10 @@ module.exports = {
12186
'test/stub/**/*.js',
12287
'test/unit-global/**/*.js',
12388
],
89+
excludedFiles: [
90+
'app/scripts/lockdown-run.js',
91+
'app/scripts/lockdown-more.js',
92+
],
12493
extends: [
12594
path.resolve(__dirname, '.eslintrc.base.js'),
12695
path.resolve(__dirname, '.eslintrc.node.js'),
@@ -289,12 +258,6 @@ module.exports = {
289258
},
290259
},
291260
},
292-
{
293-
files: ['*.d.ts'],
294-
parserOptions: {
295-
sourceType: 'script',
296-
},
297-
},
298261
/**
299262
* == Everything else ==
300263
*
@@ -434,6 +397,9 @@ module.exports = {
434397
// things like force the test to fail.
435398
'@babel/no-invalid-this': 'off',
436399
'mocha/no-setup-in-describe': 'off',
400+
401+
// Static hex values are only discouraged in application code, using them in tests is OK.
402+
'@metamask/design-tokens/color-no-hex': 'off',
437403
},
438404
},
439405
/**
@@ -481,6 +447,10 @@ module.exports = {
481447
rules: {
482448
'import/unambiguous': 'off',
483449
'import/named': 'off',
450+
451+
// Static hex values are only discouraged in application code, using them in tests is OK.
452+
'@metamask/design-tokens/color-no-hex': 'off',
453+
484454
// *.snap files weren't parsed by previous versions of this eslint
485455
// config section, but something got fixed somewhere, and now this rule
486456
// causes failures. We need to turn it off instead of fix them because
@@ -512,17 +482,25 @@ module.exports = {
512482
},
513483
},
514484
/**
515-
* Migrations
485+
* Jest files that aren't currently covered by Jest configuration above
486+
*
487+
* TODO: Update the `files` list for the Jest configuration.
516488
*/
517489
{
518-
files: ['app/scripts/migrations/*.js', '**/*.stories.js'],
490+
files: ['**/*.test.{js,ts,tsx}'],
519491
rules: {
520-
'import/no-anonymous-default-export': [
521-
'error',
522-
{
523-
allowObject: true,
524-
},
525-
],
492+
// Static hex values are only discouraged in application code, using them in tests is OK.
493+
'@metamask/design-tokens/color-no-hex': 'off',
494+
},
495+
},
496+
/**
497+
* Legacy migrations
498+
*/
499+
{
500+
files: ['app/scripts/migrations/*.js'],
501+
rules: {
502+
// Disable various rules that our legacy migrations don't follow
503+
'import/no-anonymous-default-export': 'off',
526504
},
527505
},
528506
/**
@@ -555,12 +533,30 @@ module.exports = {
555533
Compartment: 'readonly',
556534
},
557535
},
536+
/**
537+
* Storybook
538+
*/
558539
{
559-
files: ['app/scripts/lockdown-run.js', 'app/scripts/lockdown-more.js'],
560-
parserOptions: {
561-
sourceType: 'script',
540+
files: ['**/*.stories.js', '**/*.stories.ts', '**/*.stories.tsx'],
541+
// Suggested addition from the storybook 6.5 update
542+
extends: ['plugin:storybook/recommended'],
543+
rules: {
544+
// Anonymous object exports are conventional for Storybook files
545+
'import/no-anonymous-default-export': [
546+
'error',
547+
{
548+
allowObject: true,
549+
},
550+
],
551+
// Static hex values are only discouraged in application code, using them in stories is OK.
552+
'@metamask/design-tokens/color-no-hex': 'off',
562553
},
563554
},
555+
/**
556+
* Modules with sorted keys (to be expanded over time)
557+
*
558+
* TODO: Either continue migrating code to this rule, or abandon the effort.
559+
*/
564560
{
565561
files: ['ui/pages/settings/*.js'],
566562
rules: {
@@ -573,13 +569,13 @@ module.exports = {
573569
],
574570
},
575571
},
572+
/**
573+
* Modules with sorted imports
574+
*
575+
* TODO: Remove in favor of `import-x/order`, which our shared config uses.
576+
*/
576577
{
577578
files: ['ui/components/multichain/**/*.{js}'],
578-
extends: [
579-
path.resolve(__dirname, '.eslintrc.base.js'),
580-
path.resolve(__dirname, '.eslintrc.node.js'),
581-
path.resolve(__dirname, '.eslintrc.babel.js'),
582-
],
583579
rules: {
584580
'sort-imports': [
585581
'error',
@@ -594,18 +590,23 @@ module.exports = {
594590
},
595591
},
596592
/**
597-
* Don't check for static hex values in .test, .spec or .stories files
593+
* TypeScript declaration files.
594+
*
595+
* TODO: Move this to `@metamask/eslint-config-typescript`
598596
*/
599597
{
600-
files: [
601-
'**/*.test.{js,ts,tsx}',
602-
'**/*.spec.{js,ts,tsx}',
603-
'**/*.stories.{js,ts,tsx}',
604-
],
598+
files: ['**/*.d.ts'],
605599
rules: {
606-
'@metamask/design-tokens/color-no-hex': 'off',
600+
'import/unambiguous': 'off',
607601
},
608602
},
603+
/**
604+
* Prevent new references to deprecated "globally selected network"
605+
*
606+
* This can be removed after all usages have been removed.
607+
*
608+
* TODO: Expand coverage to include non-confirmation UI as well.
609+
*/
609610
{
610611
files: ['ui/pages/confirmations/**/*.{js,ts,tsx}'],
611612
rules: {

.eslintrc.jsdoc.js

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)