Skip to content

Commit

Permalink
chore(deps): update dependency eslint to v9 (#16661)
Browse files Browse the repository at this point in the history
Co-authored-by: bluwy <bjornlu.dev@gmail.com>
  • Loading branch information
renovate[bot] and bluwy committed Jun 18, 2024
1 parent 5fe0af7 commit 6c10662
Show file tree
Hide file tree
Showing 16 changed files with 175 additions and 204 deletions.
17 changes: 8 additions & 9 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -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,
Expand All @@ -43,7 +42,7 @@ export default tseslint.config(
},
plugins: {
n: pluginN,
i: pluginI,
'import-x': pluginImportX,
},
rules: {
'n/no-exports-assign': 'error',
Expand Down Expand Up @@ -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',
{
Expand Down Expand Up @@ -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',
},
},
{
Expand Down
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "^8.57.0",
"eslint-plugin-i": "^2.29.1",
"eslint": "^9.5.0",
"eslint-plugin-import-x": "^0.5.1",
"eslint-plugin-n": "^17.9.0",
"eslint-plugin-regexp": "^2.6.0",
"execa": "^9.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/create-vite/template-react-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@typescript-eslint/eslint-plugin": "^7.13.1",
"@typescript-eslint/parser": "^7.13.1",
"@vitejs/plugin-react": "^4.3.1",
"eslint": "^8.57.0",
"eslint": "^9.5.0",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-refresh": "^0.4.7",
"typescript": "^5.2.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/create-vite/template-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^4.3.1",
"eslint": "^8.57.0",
"eslint": "^9.5.0",
"eslint-plugin-react": "^7.34.2",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-refresh": "^0.4.7",
Expand Down
1 change: 0 additions & 1 deletion packages/vite/src/client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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'
2 changes: 1 addition & 1 deletion playground/cli-module/vite.config.js
Original file line number Diff line number Diff line change
@@ -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'

Expand Down
2 changes: 1 addition & 1 deletion playground/css/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion playground/js-sourcemap/importee-pkg/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// eslint-disable-next-line i/no-commonjs
// eslint-disable-next-line import-x/no-commonjs
exports.foo = 'foo'
2 changes: 1 addition & 1 deletion playground/object-hooks/vite.config.ts
Original file line number Diff line number Diff line change
@@ -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'

Expand Down
Original file line number Diff line number Diff line change
@@ -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' : ''
4 changes: 2 additions & 2 deletions playground/optimize-deps/dep-with-builtin-module-cjs/index.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions playground/optimize-deps/dep-with-builtin-module-esm/index.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion playground/resolve/browser-field/relative.js
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
2 changes: 1 addition & 1 deletion playground/resolve/exports-with-module-condition/index.js
Original file line number Diff line number Diff line change
@@ -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)'
Loading

0 comments on commit 6c10662

Please sign in to comment.