1- /* eslint-disable import/no-commonjs */
1+ /* eslint-disable import-x /no-commonjs */
22module . exports = {
33 root : true ,
44 parser : '@typescript-eslint/parser' ,
@@ -9,7 +9,7 @@ module.exports = {
99 '@react-native' ,
1010 'eslint:recommended' ,
1111 // '@metamask/eslint-config', // TODO: Enable when ready
12- 'plugin:import/warnings' ,
12+ 'plugin:import-x /warnings' ,
1313 'plugin:react/recommended' ,
1414 ] ,
1515 // ESLint can find the plugin without the `eslint-plugin-` prefix. Ex. `eslint-plugin-react-compiler` -> `react-compiler`
@@ -51,6 +51,65 @@ module.exports = {
5151 allow : [ 'Text' ] ,
5252 } ,
5353 ] ,
54+
55+ // These rule modifications are removing changes to our shared ESLint config made after
56+ // version v9. This is a temporary measure to get us to ESLint v9 compatible versions,
57+ // at which point we can restore the intended rules and use error suppression instead.
58+ //
59+ // TODO: Remove these modifications after the ESLint v9 update
60+ '@typescript-eslint/await-thenable' : 'off' ,
61+ '@typescript-eslint/consistent-type-imports' : 'off' ,
62+ '@typescript-eslint/consistent-type-exports' : 'off' ,
63+ '@typescript-eslint/explicit-function-return-type' : 'off' ,
64+ '@typescript-eslint/naming-convention' : 'off' ,
65+ '@typescript-eslint/no-base-to-string' : 'off' ,
66+ '@typescript-eslint/no-duplicate-type-constituents' : 'off' ,
67+ '@typescript-eslint/no-empty-object-type' : 'off' ,
68+ '@typescript-eslint/no-floating-promises' : 'off' ,
69+ '@typescript-eslint/no-implied-eval' : 'off' ,
70+ '@typescript-eslint/no-misused-promises' : 'off' ,
71+ '@typescript-eslint/no-redundant-type-constituents' : 'off' ,
72+ '@typescript-eslint/no-throw-literal' : 'off' ,
73+ '@typescript-eslint/no-unnecessary-type-assertion' : 'off' ,
74+ '@typescript-eslint/no-unnecessary-type-arguments' : 'off' ,
75+ '@typescript-eslint/no-unsafe-enum-comparison' : 'off' ,
76+ '@typescript-eslint/no-unnecessary-boolean-literal-compare' : 'off' ,
77+ '@typescript-eslint/no-unused-vars' : 'off' ,
78+ '@typescript-eslint/no-wrapper-object-types' : 'off' ,
79+ '@typescript-eslint/only-throw-error' : 'off' ,
80+ '@typescript-eslint/prefer-enum-initializers' : 'off' ,
81+ '@typescript-eslint/prefer-includes' : 'off' ,
82+ '@typescript-eslint/prefer-nullish-coalescing' : 'off' ,
83+ '@typescript-eslint/prefer-optional-chain' : 'off' ,
84+ '@typescript-eslint/prefer-promise-reject-errors' : 'off' ,
85+ '@typescript-eslint/prefer-readonly' : 'off' ,
86+ '@typescript-eslint/prefer-reduce-type-parameter' : 'off' ,
87+ '@typescript-eslint/prefer-string-starts-ends-with' : 'off' ,
88+ '@typescript-eslint/promise-function-async' : 'off' ,
89+ '@typescript-eslint/restrict-plus-operands' : 'off' ,
90+ '@typescript-eslint/restrict-template-expressions' : 'off' ,
91+ '@typescript-eslint/switch-exhaustiveness-check' : 'off' ,
92+ '@typescript-eslint/unbound-method' : 'off' ,
93+ 'no-restricted-syntax' : [
94+ 'error' ,
95+ {
96+ selector : 'WithStatement' ,
97+ message : 'With statements are not allowed' ,
98+ } ,
99+ {
100+ selector : 'SequenceExpression' ,
101+ message : 'Sequence expressions are not allowed' ,
102+ } ,
103+ // {
104+ // selector: "BinaryExpression[operator='in']",
105+ // message: 'The "in" operator is not allowed',
106+ // },
107+ // {
108+ // selector:
109+ // "PropertyDefinition[accessibility='private'], MethodDefinition[accessibility='private'], TSParameterProperty[accessibility='private']",
110+ // message: 'Use a hash name instead.',
111+ // },
112+ ] ,
54113 } ,
55114 } ,
56115 {
@@ -86,8 +145,8 @@ module.exports = {
86145 } ,
87146 rules : {
88147 'no-console' : 'off' ,
89- 'import/no-commonjs' : 'off' ,
90- 'import/no-nodejs-modules' : 'off' ,
148+ 'import-x /no-commonjs' : 'off' ,
149+ 'import-x /no-nodejs-modules' : 'off' ,
91150 } ,
92151 } ,
93152 {
@@ -98,8 +157,8 @@ module.exports = {
98157 ] ,
99158 rules : {
100159 'no-console' : 'off' ,
101- 'import/no-commonjs' : 'off' ,
102- 'import/no-nodejs-modules' : 'off' ,
160+ 'import-x /no-commonjs' : 'off' ,
161+ 'import-x /no-nodejs-modules' : 'off' ,
103162 } ,
104163 } ,
105164 {
@@ -361,10 +420,13 @@ module.exports = {
361420 '@typescript-eslint/no-floating-promises' : 'error' ,
362421 '@typescript-eslint/restrict-template-expressions' : 'error' ,
363422
364- // === Import rules (using 'import' plugin, not 'import-x') ===
365- 'import/consistent-type-specifier-style' : [ 'error' , 'prefer-top-level' ] ,
366- 'import/no-named-as-default' : 'error' ,
367- 'import/order' : [
423+ // === Import rules ===
424+ 'import-x/consistent-type-specifier-style' : [
425+ 'error' ,
426+ 'prefer-top-level' ,
427+ ] ,
428+ 'import-x/no-named-as-default' : 'error' ,
429+ 'import-x/order' : [
368430 'error' ,
369431 {
370432 groups : [
@@ -441,10 +503,10 @@ module.exports = {
441503 } ,
442504
443505 settings : {
444- 'import/resolver' : {
506+ 'import-x /resolver' : {
445507 typescript : { } , // this loads <rootdir>/tsconfig.json to eslint
446508 } ,
447- 'import/internal-regex' : '^@metamask/perps-controller' ,
509+ 'import-x /internal-regex' : '^@metamask/perps-controller' ,
448510 } ,
449511
450512 rules : {
@@ -466,7 +528,7 @@ module.exports = {
466528 'no-bitwise' : 'off' ,
467529 'class-methods-use-this' : 'off' ,
468530 'eol-last' : 'warn' ,
469- 'import/no-named-as-default' : 'off' ,
531+ 'import-x /no-named-as-default' : 'off' ,
470532 'no-invalid-this' : 'off' ,
471533 'no-new' : 'off' ,
472534 'react/jsx-handler-names' : 'off' ,
@@ -477,14 +539,14 @@ module.exports = {
477539 'arrow-body-style' : 'error' ,
478540 'dot-notation' : 'error' ,
479541 eqeqeq : 'error' ,
480- 'import/no-amd' : 'error' ,
481- 'import/no-commonjs' : 'error' ,
482- 'import/no-duplicates' : 'error' ,
483- 'import/no-extraneous-dependencies' : [ 'error' , { packageDir : [ './' ] } ] ,
484- 'import/no-mutable-exports' : 'error' ,
485- 'import/no-namespace' : 'error' ,
486- 'import/no-nodejs-modules' : 'error' ,
487- 'import/prefer-default-export' : 'off' ,
542+ 'import-x /no-amd' : 'error' ,
543+ 'import-x /no-commonjs' : 'error' ,
544+ 'import-x /no-duplicates' : 'error' ,
545+ 'import-x /no-extraneous-dependencies' : [ 'error' , { packageDir : [ './' ] } ] ,
546+ 'import-x /no-mutable-exports' : 'error' ,
547+ 'import-x /no-namespace' : 'error' ,
548+ 'import-x /no-nodejs-modules' : 'error' ,
549+ 'import-x /prefer-default-export' : 'off' ,
488550 'no-alert' : 'error' ,
489551 'no-constant-condition' : [
490552 'error' ,
@@ -532,7 +594,7 @@ module.exports = {
532594 'prefer-const' : 'error' ,
533595 'prefer-rest-params' : 'error' ,
534596 'prefer-spread' : 'error' ,
535- 'import/no-unresolved' : 'error' ,
597+ 'import-x /no-unresolved' : 'error' ,
536598 'eslint-comments/no-unlimited-disable' : 'off' ,
537599 'eslint-comments/no-unused-disable' : 'off' ,
538600 'react-native/no-color-literals' : 'error' ,
@@ -559,6 +621,14 @@ module.exports = {
559621 'react/prefer-es6-class' : 'error' ,
560622 '@metamask/design-tokens/color-no-hex' : 'warn' ,
561623 radix : 'off' ,
624+
625+ // These rule modifications are removing changes to our shared ESLint config made after
626+ // version v9. This is a temporary measure to get us to ESLint v9 compatible versions,
627+ // at which point we can restore the intended rules and use error suppression instead.
628+ //
629+ // TODO: Remove these modifications after the ESLint v9 update
630+ 'react-hooks/rules-of-hooks' : 'off' ,
631+ 'no-loss-of-precision' : 'off' ,
562632 } ,
563633
564634 ignorePatterns : [ 'wdio.conf.js' , 'app/util/termsOfUse/termsOfUseContent.ts' ] ,
0 commit comments