File tree Expand file tree Collapse file tree 8 files changed +11
-14
lines changed
packages/vite/src/node/ssr/runtime/__tests__/fixtures
dep-cjs-browser-field-bare
dep-cjs-with-external-deps
dep-with-builtin-module-cjs
dep-with-builtin-module-esm Expand file tree Collapse file tree 8 files changed +11
-14
lines changed Original file line number Diff line number Diff line change 1
1
// @ts -check
2
- import { builtinModules , createRequire } from 'node:module'
2
+ import { createRequire } from 'node:module'
3
3
import eslint from '@eslint/js'
4
4
import pluginN from 'eslint-plugin-n'
5
5
import pluginImportX from 'eslint-plugin-import-x'
@@ -113,6 +113,7 @@ export default tseslint.config(
113
113
allowModules : [ 'vite' ] ,
114
114
} ,
115
115
] ,
116
+ 'n/prefer-node-protocol' : 'error' ,
116
117
117
118
'@typescript-eslint/ban-ts-comment' : 'error' ,
118
119
'@typescript-eslint/no-unsafe-function-type' : 'off' ,
@@ -157,10 +158,6 @@ export default tseslint.config(
157
158
'@typescript-eslint/prefer-for-of' : 'off' ,
158
159
'@typescript-eslint/prefer-function-type' : 'off' ,
159
160
160
- 'import-x/no-nodejs-modules' : [
161
- 'error' ,
162
- { allow : builtinModules . map ( ( mod ) => `node:${ mod } ` ) } ,
163
- ] ,
164
161
'import-x/no-duplicates' : 'error' ,
165
162
'import-x/order' : [
166
163
'error' ,
Original file line number Diff line number Diff line change 1
1
export { existsSync } from 'node:fs'
2
- // eslint-disable-next-line import-x/no-nodejs-modules -- testing that importing without node prefix works
2
+ // eslint-disable-next-line n/prefer-node-protocol -- testing that importing without node prefix works
3
3
export { readdirSync } from 'fs'
Original file line number Diff line number Diff line change 1
- // eslint-disable-next-line import-x/no-nodejs-modules
1
+ // eslint-disable-next-line n/prefer-node-protocol
2
2
import { URL } from 'url'
3
3
import { defineConfig } from 'vite'
4
4
Original file line number Diff line number Diff line change 1
- /* eslint-disable import-x/no-nodejs-modules */
1
+ /* eslint-disable n/prefer-node-protocol */
2
2
import assert from 'assert'
3
3
import { defineConfig } from 'vite'
4
4
Original file line number Diff line number Diff line change 1
1
'use strict'
2
2
3
- // eslint-disable-next-line import-x/no-nodejs-modules
3
+ // eslint-disable-next-line n/prefer-node-protocol
4
4
const events = require ( 'events' )
5
5
6
6
module . exports = 'foo' in events ? 'pong' : ''
Original file line number Diff line number Diff line change 1
1
// `stream` is used as the package name for `@vitejs/test-dep-esm-dummy-node-builtin` so that it is treated like a Node builtin
2
- // eslint-disable-next-line import-x/no-nodejs-modules
2
+ // eslint-disable-next-line n/prefer-node-protocol
3
3
const externalDummyNodeBuiltin = require ( 'stream' )
4
4
const external = require ( '@vitejs/test-dep-esm-external' )
5
5
// eslint-disable-next-line no-prototype-builtins
Original file line number Diff line number Diff line change 1
1
// no node: protocol intentionally
2
- // eslint-disable-next-line import-x/no-nodejs-modules
2
+ // eslint-disable-next-line n/prefer-node-protocol
3
3
const fs = require ( 'fs' )
4
- // eslint-disable-next-line import-x/no-nodejs-modules
4
+ // eslint-disable-next-line n/prefer-node-protocol
5
5
const path = require ( 'path' )
6
6
7
7
// NOTE: require destructure would error immediately because of how esbuild
Original file line number Diff line number Diff line change 1
1
// no node: protocol intentionally
2
- // eslint-disable-next-line import-x/no-nodejs-modules
2
+ // eslint-disable-next-line n/prefer-node-protocol
3
3
import { readFileSync } from 'fs'
4
- // eslint-disable-next-line import-x/no-nodejs-modules
4
+ // eslint-disable-next-line n/prefer-node-protocol
5
5
import path from 'path'
6
6
7
7
// access from named import
You can’t perform that action at this time.
0 commit comments