Skip to content

Commit 7c7f2be

Browse files
committed
chore: Update @metamask/eslint-config-typescript to v13
The ESLint configuration for TypeScript has been updated to prepare for ESLint v9 (this is the last major version before ESLint v9 is required). Various related libraries needed to be updated as well. The most disruptive part is that in v13, `eslint-plugin-import` was replaced with `eslint-plugin-import-x`. This required widespread changes to any reference to an `import/` rule (it's now `import-x/`), but there should be no functional changes. `eslint-plugin-import-x` is a drop-in replacement for `eslint-plugin-import`.
1 parent 38ebc67 commit 7c7f2be

File tree

354 files changed

+1045
-725
lines changed

Some content is hidden

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

354 files changed

+1045
-725
lines changed

.eslintrc.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable import/no-commonjs */
1+
/* eslint-disable import-x/no-commonjs */
22
module.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`
@@ -86,16 +86,16 @@ module.exports = {
8686
},
8787
rules: {
8888
'no-console': 'off',
89-
'import/no-commonjs': 'off',
90-
'import/no-nodejs-modules': 'off',
89+
'import-x/no-commonjs': 'off',
90+
'import-x/no-nodejs-modules': 'off',
9191
},
9292
},
9393
{
9494
files: ['scripts/**/*.js', 'tests/tools/**/*.{js,ts}', 'app.config.js'],
9595
rules: {
9696
'no-console': 'off',
97-
'import/no-commonjs': 'off',
98-
'import/no-nodejs-modules': 'off',
97+
'import-x/no-commonjs': 'off',
98+
'import-x/no-nodejs-modules': 'off',
9999
},
100100
},
101101
{
@@ -332,9 +332,9 @@ module.exports = {
332332
'@typescript-eslint/restrict-template-expressions': 'error',
333333

334334
// === Import rules (using 'import' plugin, not 'import-x') ===
335-
'import/consistent-type-specifier-style': ['error', 'prefer-top-level'],
336-
'import/no-named-as-default': 'error',
337-
'import/order': [
335+
'import-x/consistent-type-specifier-style': ['error', 'prefer-top-level'],
336+
'import-x/no-named-as-default': 'error',
337+
'import-x/order': [
338338
'error',
339339
{
340340
groups: [
@@ -411,10 +411,10 @@ module.exports = {
411411
},
412412

413413
settings: {
414-
'import/resolver': {
414+
'import-x/resolver': {
415415
typescript: {}, // this loads <rootdir>/tsconfig.json to eslint
416416
},
417-
'import/internal-regex': '^@metamask/perps-controller',
417+
'import-x/internal-regex': '^@metamask/perps-controller',
418418
},
419419

420420
rules: {
@@ -436,7 +436,7 @@ module.exports = {
436436
'no-bitwise': 'off',
437437
'class-methods-use-this': 'off',
438438
'eol-last': 'warn',
439-
'import/no-named-as-default': 'off',
439+
'import-x/no-named-as-default': 'off',
440440
'no-invalid-this': 'off',
441441
'no-new': 'off',
442442
'react/jsx-handler-names': 'off',
@@ -447,14 +447,14 @@ module.exports = {
447447
'arrow-body-style': 'error',
448448
'dot-notation': 'error',
449449
eqeqeq: 'error',
450-
'import/no-amd': 'error',
451-
'import/no-commonjs': 'error',
452-
'import/no-duplicates': 'error',
453-
'import/no-extraneous-dependencies': ['error', { packageDir: ['./'] }],
454-
'import/no-mutable-exports': 'error',
455-
'import/no-namespace': 'error',
456-
'import/no-nodejs-modules': 'error',
457-
'import/prefer-default-export': 'off',
450+
'import-x/no-amd': 'error',
451+
'import-x/no-commonjs': 'error',
452+
'import-x/no-duplicates': 'error',
453+
'import-x/no-extraneous-dependencies': ['error', { packageDir: ['./'] }],
454+
'import-x/no-mutable-exports': 'error',
455+
'import-x/no-namespace': 'error',
456+
'import-x/no-nodejs-modules': 'error',
457+
'import-x/prefer-default-export': 'off',
458458
'no-alert': 'error',
459459
'no-constant-condition': [
460460
'error',
@@ -502,7 +502,7 @@ module.exports = {
502502
'prefer-const': 'error',
503503
'prefer-rest-params': 'error',
504504
'prefer-spread': 'error',
505-
'import/no-unresolved': 'error',
505+
'import-x/no-unresolved': 'error',
506506
'eslint-comments/no-unlimited-disable': 'off',
507507
'eslint-comments/no-unused-disable': 'off',
508508
'react-native/no-color-literals': 'error',

app/__mocks__/@metamask/native-utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/* eslint-disable import/no-extraneous-dependencies */
2-
/* eslint-disable import/no-commonjs */
1+
/* eslint-disable import-x/no-extraneous-dependencies */
2+
/* eslint-disable import-x/no-commonjs */
33
/**
44
* Mock for @metamask/native-utils
55
*

app/__mocks__/pngMock.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// When required, assets in React Native returns a number
2-
// eslint-disable-next-line import/no-commonjs
2+
// eslint-disable-next-line import-x/no-commonjs
33
module.exports = 1;

app/__mocks__/react-native-i18n.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// eslint-disable-next-line import/no-extraneous-dependencies
1+
// eslint-disable-next-line import-x/no-extraneous-dependencies
22
import I18nJs from 'i18n-js';
33

44
I18nJs.locale = 'en'; // a locale from your available translations

app/__mocks__/spinnerMock.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable import/no-commonjs */
1+
/* eslint-disable import-x/no-commonjs */
22

33
module.exports = {
44
Spinner: () => null,

app/actions/navigation/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable import/prefer-default-export */
1+
/* eslint-disable import-x/prefer-default-export */
22
import {
33
type OnNavigationReadyAction,
44
type SetCurrentRouteAction,

app/actions/security/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable import/prefer-default-export */
1+
/* eslint-disable import-x/prefer-default-export */
22
import type { Action as ReduxAction } from 'redux';
33

44
export enum ActionType {

app/component-library/base-components/TagBase/TagBase.constants.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable import/prefer-default-export */
1+
/* eslint-disable import-x/prefer-default-export */
22
// Third library dependencies.
33
import React from 'react';
44

app/component-library/components-temp/MainActionButton/MainActionButton.constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable import/prefer-default-export */
1+
/* eslint-disable import-x/prefer-default-export */
22

33
// Test IDs
44
export const MAINACTIONBUTTON_TEST_ID = 'main-action-button';

app/component-library/components-temp/Price/AggregatedPercentage/NonEvmAggregatedPercentage.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
FORMATTED_PERCENTAGE_TEST_ID,
99
} from './AggregatedPercentage.constants';
1010
import NonEvmAggregatedPercentage from './NonEvmAggregatedPercentage';
11-
// eslint-disable-next-line import/no-namespace
11+
// eslint-disable-next-line import-x/no-namespace
1212
import * as multichain from '../../../../selectors/multichain/multichain';
1313
import { selectMultichainAssetsRates } from '../../../../selectors/multichain/multichain';
1414

0 commit comments

Comments
 (0)