diff --git a/eslint.config.js b/eslint.config.js index 5784d7484af2df..0b103b51776cef 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -2,9 +2,8 @@ import { builtinModules, createRequire } from 'node:module' import eslint from '@eslint/js' import pluginN from 'eslint-plugin-n' -import * as pluginI from 'eslint-plugin-i' +import pluginImportX from 'eslint-plugin-import-x' import pluginRegExp from 'eslint-plugin-regexp' -import tsParser from '@typescript-eslint/parser' import tseslint from 'typescript-eslint' import globals from 'globals' @@ -27,11 +26,11 @@ export default tseslint.config( eslint.configs.recommended, ...tseslint.configs.recommended, ...tseslint.configs.stylistic, - /** @type {any} */ (pluginRegExp.configs['flat/recommended']), + pluginRegExp.configs['flat/recommended'], { name: 'main', languageOptions: { - parser: tsParser, + parser: tseslint.parser, parserOptions: { sourceType: 'module', ecmaVersion: 2022, @@ -43,7 +42,7 @@ export default tseslint.config( }, plugins: { n: pluginN, - i: pluginI, + 'import-x': pluginImportX, }, rules: { 'n/no-exports-assign': 'error', @@ -117,12 +116,12 @@ export default tseslint.config( '@typescript-eslint/prefer-for-of': 'off', '@typescript-eslint/prefer-function-type': 'off', - 'i/no-nodejs-modules': [ + 'import-x/no-nodejs-modules': [ 'error', { allow: builtinModules.map((mod) => `node:${mod}`) }, ], - 'i/no-duplicates': 'error', - 'i/order': 'error', + 'import-x/no-duplicates': 'error', + 'import-x/order': 'error', 'sort-imports': [ 'error', { @@ -177,7 +176,7 @@ export default tseslint.config( 'playground/tailwind/**', // blocked by https://github.com/postcss/postcss-load-config/issues/239 ], rules: { - 'i/no-commonjs': 'error', + 'import-x/no-commonjs': 'error', }, }, { diff --git a/package.json b/package.json index 3829700704877b..a878d4c1198f4f 100644 --- a/package.json +++ b/package.json @@ -55,12 +55,10 @@ "@types/picomatch": "^2.3.3", "@types/stylus": "^0.48.42", "@types/ws": "^8.5.10", - "@typescript-eslint/eslint-plugin": "^7.13.1", - "@typescript-eslint/parser": "^7.13.1", "@vitejs/release-scripts": "^1.3.1", "conventional-changelog-cli": "^5.0.0", "eslint": "^9.5.0", - "eslint-plugin-i": "^2.29.1", + "eslint-plugin-import-x": "^0.5.1", "eslint-plugin-n": "^17.9.0", "eslint-plugin-regexp": "^2.6.0", "execa": "^9.2.0", diff --git a/packages/vite/src/client/client.ts b/packages/vite/src/client/client.ts index 233c9520b02049..703fc3f7302f29 100644 --- a/packages/vite/src/client/client.ts +++ b/packages/vite/src/client/client.ts @@ -353,7 +353,6 @@ async function waitForSuccessfulPing( } await wait(ms) - // eslint-disable-next-line no-constant-condition while (true) { if (document.visibilityState === 'visible') { if (await ping()) { diff --git a/packages/vite/src/node/ssr/runtime/__tests__/fixtures/native.js b/packages/vite/src/node/ssr/runtime/__tests__/fixtures/native.js index b1f9ea4df7b9ae..8908ac97d12303 100644 --- a/packages/vite/src/node/ssr/runtime/__tests__/fixtures/native.js +++ b/packages/vite/src/node/ssr/runtime/__tests__/fixtures/native.js @@ -1,3 +1,3 @@ export { existsSync } from 'node:fs' -// eslint-disable-next-line i/no-nodejs-modules -- testing that importing without node prefix works +// eslint-disable-next-line import-x/no-nodejs-modules -- testing that importing without node prefix works export { readdirSync } from 'fs' diff --git a/playground/cli-module/vite.config.js b/playground/cli-module/vite.config.js index 89fe27b409b646..dedbf2ef658f86 100644 --- a/playground/cli-module/vite.config.js +++ b/playground/cli-module/vite.config.js @@ -1,4 +1,4 @@ -// eslint-disable-next-line i/no-nodejs-modules +// eslint-disable-next-line import-x/no-nodejs-modules import { URL } from 'url' import { defineConfig } from 'vite' diff --git a/playground/css/main.js b/playground/css/main.js index 05a9c426f3419c..97fa123e37ef5d 100644 --- a/playground/css/main.js +++ b/playground/css/main.js @@ -51,7 +51,7 @@ import './layered/index.css' import './dep.css' import './glob-dep.css' -// eslint-disable-next-line i/order +// eslint-disable-next-line import-x/order import { barModuleClasses } from '@vitejs/test-css-js-dep' document .querySelector('.css-js-dep-module') diff --git a/playground/js-sourcemap/importee-pkg/index.js b/playground/js-sourcemap/importee-pkg/index.js index d101d3b2599e8d..95403a93f0d308 100644 --- a/playground/js-sourcemap/importee-pkg/index.js +++ b/playground/js-sourcemap/importee-pkg/index.js @@ -1,2 +1,2 @@ -// eslint-disable-next-line i/no-commonjs +// eslint-disable-next-line import-x/no-commonjs exports.foo = 'foo' diff --git a/playground/object-hooks/vite.config.ts b/playground/object-hooks/vite.config.ts index c0d80292463b6c..ac25d69ba85a17 100644 --- a/playground/object-hooks/vite.config.ts +++ b/playground/object-hooks/vite.config.ts @@ -1,4 +1,4 @@ -/* eslint-disable i/no-nodejs-modules */ +/* eslint-disable import-x/no-nodejs-modules */ import assert from 'assert' import { defineConfig } from 'vite' diff --git a/playground/optimize-deps/dep-cjs-browser-field-bare/internal.js b/playground/optimize-deps/dep-cjs-browser-field-bare/internal.js index 5868e14e44429e..5bd55071bfcc48 100644 --- a/playground/optimize-deps/dep-cjs-browser-field-bare/internal.js +++ b/playground/optimize-deps/dep-cjs-browser-field-bare/internal.js @@ -1,6 +1,6 @@ 'use strict' -// eslint-disable-next-line i/no-nodejs-modules +// eslint-disable-next-line import-x/no-nodejs-modules const events = require('events') module.exports = 'foo' in events ? 'pong' : '' diff --git a/playground/optimize-deps/dep-with-builtin-module-cjs/index.js b/playground/optimize-deps/dep-with-builtin-module-cjs/index.js index 91c5f599da39fd..17c7253a0d842e 100644 --- a/playground/optimize-deps/dep-with-builtin-module-cjs/index.js +++ b/playground/optimize-deps/dep-with-builtin-module-cjs/index.js @@ -1,7 +1,7 @@ // no node: protocol intentionally -// eslint-disable-next-line i/no-nodejs-modules +// eslint-disable-next-line import-x/no-nodejs-modules const fs = require('fs') -// eslint-disable-next-line i/no-nodejs-modules +// eslint-disable-next-line import-x/no-nodejs-modules const path = require('path') // NOTE: require destructure would error immediately because of how esbuild diff --git a/playground/optimize-deps/dep-with-builtin-module-esm/index.js b/playground/optimize-deps/dep-with-builtin-module-esm/index.js index 45defaf3f0565f..f2d5fbc2480353 100644 --- a/playground/optimize-deps/dep-with-builtin-module-esm/index.js +++ b/playground/optimize-deps/dep-with-builtin-module-esm/index.js @@ -1,7 +1,7 @@ // no node: protocol intentionally -// eslint-disable-next-line i/no-nodejs-modules +// eslint-disable-next-line import-x/no-nodejs-modules import { readFileSync } from 'fs' -// eslint-disable-next-line i/no-nodejs-modules +// eslint-disable-next-line import-x/no-nodejs-modules import path from 'path' // access from named import diff --git a/playground/resolve/browser-field/relative.js b/playground/resolve/browser-field/relative.js index 4629659ee6f843..660d6be578a728 100644 --- a/playground/resolve/browser-field/relative.js +++ b/playground/resolve/browser-field/relative.js @@ -1,4 +1,4 @@ -/* eslint-disable i/no-duplicates */ +/* eslint-disable import-x/no-duplicates */ import ra from './no-ext' import rb from './no-ext.js' // no substitution import rc from './ext' diff --git a/playground/resolve/exports-with-module-condition/index.js b/playground/resolve/exports-with-module-condition/index.js index 53b7bb50be4e8b..d38a0e272c457d 100644 --- a/playground/resolve/exports-with-module-condition/index.js +++ b/playground/resolve/exports-with-module-condition/index.js @@ -1,2 +1,2 @@ -/* eslint-disable i/no-commonjs */ +/* eslint-disable import-x/no-commonjs */ module.exports.msg = '[fail] exports with module condition (index.js)' diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 565e112fc9b035..a13f7fa3d9f191 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -70,12 +70,6 @@ importers: '@types/ws': specifier: ^8.5.10 version: 8.5.10 - '@typescript-eslint/eslint-plugin': - specifier: ^7.13.1 - version: 7.13.1(@typescript-eslint/parser@7.13.1(eslint@9.5.0)(typescript@5.2.2))(eslint@9.5.0)(typescript@5.2.2) - '@typescript-eslint/parser': - specifier: ^7.13.1 - version: 7.13.1(eslint@9.5.0)(typescript@5.2.2) '@vitejs/release-scripts': specifier: ^1.3.1 version: 1.3.1 @@ -85,9 +79,9 @@ importers: eslint: specifier: ^9.5.0 version: 9.5.0 - eslint-plugin-i: - specifier: ^2.29.1 - version: 2.29.1(@typescript-eslint/parser@7.13.1(eslint@9.5.0)(typescript@5.2.2))(eslint@9.5.0) + eslint-plugin-import-x: + specifier: ^0.5.1 + version: 0.5.1(eslint@9.5.0)(typescript@5.2.2) eslint-plugin-n: specifier: ^17.9.0 version: 17.9.0(eslint@9.5.0) @@ -4369,38 +4363,17 @@ packages: eslint-import-resolver-node@0.3.9: resolution: {integrity: sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==} - eslint-module-utils@2.8.0: - resolution: {integrity: sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==} - engines: {node: '>=4'} - peerDependencies: - '@typescript-eslint/parser': '*' - eslint: '*' - eslint-import-resolver-node: '*' - eslint-import-resolver-typescript: '*' - eslint-import-resolver-webpack: '*' - peerDependenciesMeta: - '@typescript-eslint/parser': - optional: true - eslint: - optional: true - eslint-import-resolver-node: - optional: true - eslint-import-resolver-typescript: - optional: true - eslint-import-resolver-webpack: - optional: true - eslint-plugin-es-x@7.5.0: resolution: {integrity: sha512-ODswlDSO0HJDzXU0XvgZ3lF3lS3XAZEossh15Q2UHjwrJggWeBoKqqEsLTZLXl+dh5eOAozG0zRcYtuE35oTuQ==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: eslint: '>=8' - eslint-plugin-i@2.29.1: - resolution: {integrity: sha512-ORizX37MelIWLbMyqI7hi8VJMf7A0CskMmYkB+lkCX3aF4pkGV7kwx5bSEb4qx7Yce2rAf9s34HqDRPjGRZPNQ==} - engines: {node: '>=12'} + eslint-plugin-import-x@0.5.1: + resolution: {integrity: sha512-2JK8bbFOLes+gG6tgdnM8safCxMAj4u2wjX8X1BRFPfnY7Ct2hFYESoIcVwABX/DDcdpQFLGtKmzbNEWJZD9iQ==} + engines: {node: '>=16'} peerDependencies: - eslint: ^7.2.0 || ^8 + eslint: ^8.56.0 || ^9.0.0-0 eslint-plugin-n@17.9.0: resolution: {integrity: sha512-CPSaXDXdrT4nsrOrO4mT4VB6FMUkoySRkHWuuJJHVqsIEjIeZgMY1H7AzSwPbDScikBmLN82KeM1u7ixV7PzGg==} @@ -9677,16 +9650,6 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-module-utils@2.8.0(@typescript-eslint/parser@7.13.1(eslint@9.5.0)(typescript@5.2.2))(eslint-import-resolver-node@0.3.9)(eslint@9.5.0): - dependencies: - debug: 3.2.7 - optionalDependencies: - '@typescript-eslint/parser': 7.13.1(eslint@9.5.0)(typescript@5.2.2) - eslint: 9.5.0 - eslint-import-resolver-node: 0.3.9 - transitivePeerDependencies: - - supports-color - eslint-plugin-es-x@7.5.0(eslint@9.5.0): dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@9.5.0) @@ -9694,22 +9657,21 @@ snapshots: eslint: 9.5.0 eslint-compat-utils: 0.1.2(eslint@9.5.0) - eslint-plugin-i@2.29.1(@typescript-eslint/parser@7.13.1(eslint@9.5.0)(typescript@5.2.2))(eslint@9.5.0): + eslint-plugin-import-x@0.5.1(eslint@9.5.0)(typescript@5.2.2): dependencies: + '@typescript-eslint/utils': 7.13.1(eslint@9.5.0)(typescript@5.2.2) debug: 4.3.5 doctrine: 3.0.0 eslint: 9.5.0 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.8.0(@typescript-eslint/parser@7.13.1(eslint@9.5.0)(typescript@5.2.2))(eslint-import-resolver-node@0.3.9)(eslint@9.5.0) - get-tsconfig: 4.7.2 + get-tsconfig: 4.7.5 is-glob: 4.0.3 - minimatch: 3.1.2 + minimatch: 9.0.4 semver: 7.6.0 + tslib: 2.6.3 transitivePeerDependencies: - - '@typescript-eslint/parser' - - eslint-import-resolver-typescript - - eslint-import-resolver-webpack - supports-color + - typescript eslint-plugin-n@17.9.0(eslint@9.5.0): dependencies: