Skip to content

Commit 70cbdfe

Browse files
committed
style: disable useNodejsImportProtocol in Biome config
Bare imports (without 'node:' prefix) are intentional for better bundler compatibility. Disabling the Biome rule to avoid duplication with ESLint n/prefer-node-protocol ignores already in place.
1 parent 43bc3e6 commit 70cbdfe

File tree

19 files changed

+44
-57
lines changed

19 files changed

+44
-57
lines changed

biome.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
"useAsConstAssertion": "error",
7474
"useDefaultParameterLast": "error",
7575
"useEnumInitializers": "error",
76+
"useNodejsImportProtocol": "off",
7677
"useSelfClosingElements": "error",
7778
"useSingleVarDeclarator": "error",
7879
"noUnusedTemplateLiteral": "error",

plugins/babel-plugin-inline-require-calls.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use strict'
2-
31
const { createRequire } = require('node:module')
42
const fs = require('node:fs')
53
const path = require('node:path')

src/constants/platform.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
* Platform detection and OS-specific constants.
33
*/
44

5-
// eslint-disable-next-line n/prefer-node-protocol
6-
import { platform } from 'os'
5+
import { platform } from 'node:os'
76

87
// Platform detection.
98
const _platform = platform()

src/cover/code.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
* @fileoverview Code coverage utilities for parsing v8 coverage data.
33
*/
44

5-
// eslint-disable-next-line n/prefer-node-protocol
6-
import { promises as fs } from 'fs'
5+
import { promises as fs } from 'node:fs'
76

87
import { readJson } from '../fs'
98
import { isObjectObject } from '../objects'

src/dlx-binary.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
/** @fileoverview DLX binary execution utilities for Socket ecosystem. */
22

3-
// eslint-disable-next-line n/prefer-node-protocol
4-
import { createHash } from 'crypto'
5-
// eslint-disable-next-line n/prefer-node-protocol
6-
import os from 'os'
7-
// eslint-disable-next-line n/prefer-node-protocol
8-
import path from 'path'
3+
import { createHash } from 'node:crypto'
4+
5+
import os from 'node:os'
6+
7+
import path from 'node:path'
98

109
import { WIN32 } from '#constants/platform'
1110

@@ -31,8 +30,8 @@ let _fs: typeof import('fs') | undefined
3130
function getFs() {
3231
if (_fs === undefined) {
3332
// Use non-'node:' prefixed require to avoid Webpack errors.
34-
// eslint-disable-next-line n/prefer-node-protocol
35-
_fs = /*@__PURE__*/ require('fs')
33+
34+
_fs = /*@__PURE__*/ require('node:fs')
3635
}
3736
return _fs as typeof import('fs')
3837
}

src/dlx-package.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@
3030
* - dlxPackage() combines both for convenience
3131
*/
3232

33-
// eslint-disable-next-line n/prefer-node-protocol
34-
import path from 'path'
33+
import path from 'node:path'
3534

3635
import { WIN32 } from './constants/platform'
3736
import { getPacoteCachePath } from './constants/packages'
@@ -55,8 +54,8 @@ let _fs: typeof import('fs') | undefined
5554
function getFs() {
5655
if (_fs === undefined) {
5756
// Use non-'node:' prefixed require to avoid Webpack errors.
58-
// eslint-disable-next-line n/prefer-node-protocol
59-
_fs = /*@__PURE__*/ require('fs')
57+
58+
_fs = /*@__PURE__*/ require('node:fs')
6059
}
6160
return _fs as typeof import('fs')
6261
}

src/dlx.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/** @fileoverview DLX (execute package) utilities for Socket ecosystem shared installations. */
22

3-
// eslint-disable-next-line n/prefer-node-protocol
4-
import { createHash } from 'crypto'
3+
import { createHash } from 'node:crypto'
54

65
import { readDirNamesSync, safeDelete, safeMkdir, safeMkdirSync } from './fs'
76
import { normalizePath } from './path'
@@ -20,8 +19,8 @@ let _fs: typeof import('fs') | undefined
2019
function getFs() {
2120
if (_fs === undefined) {
2221
// Use non-'node:' prefixed require to avoid Webpack errors.
23-
// eslint-disable-next-line n/prefer-node-protocol
24-
_fs = /*@__PURE__*/ require('fs')
22+
23+
_fs = /*@__PURE__*/ require('node:fs')
2524
}
2625
return _fs as typeof import('fs')
2726
}

src/download-lock.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@
99
* `downloadWithLock()` from this module.
1010
*/
1111

12-
// eslint-disable-next-line n/prefer-node-protocol
13-
import { existsSync } from 'fs'
14-
// eslint-disable-next-line n/prefer-node-protocol
15-
import { mkdir, readFile, rm, stat, writeFile } from 'fs/promises'
16-
// eslint-disable-next-line n/prefer-node-protocol
17-
import { dirname, join } from 'path'
12+
import { existsSync } from 'node:fs'
13+
14+
import { mkdir, readFile, rm, stat, writeFile } from 'node:fs/promises'
15+
16+
import { dirname, join } from 'node:path'
1817
import type { HttpDownloadOptions, HttpDownloadResult } from './http-request'
1918
import { httpDownload } from './http-request'
2019

src/env/rewire.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
* - Thread-safe for concurrent test execution
1010
*/
1111

12-
// eslint-disable-next-line n/prefer-node-protocol
13-
import { AsyncLocalStorage } from 'async_hooks'
12+
import { AsyncLocalStorage } from 'node:async_hooks'
1413

1514
type EnvOverrides = Map<string, string | undefined>
1615

src/fs.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
* Provides enhanced fs operations, glob matching, and directory traversal functions.
44
*/
55

6-
// eslint-disable-next-line n/prefer-node-protocol
7-
import type { Abortable } from 'events'
8-
// eslint-disable-next-line n/prefer-node-protocol
6+
import type { Abortable } from 'node:events'
7+
98
import type {
109
Dirent,
1110
MakeDirectoryOptions,
@@ -14,7 +13,7 @@ import type {
1413
PathLike,
1514
StatSyncOptions,
1615
WriteFileOptions,
17-
} from 'fs'
16+
} from 'node:fs'
1817

1918
import { getAbortSignal } from '#constants/process'
2019

@@ -309,7 +308,7 @@ let _fs: typeof import('fs') | undefined
309308
function getFs() {
310309
if (_fs === undefined) {
311310
// Use non-'node:' prefixed require to avoid Webpack errors.
312-
_fs = /*@__PURE__*/ require('fs')
311+
_fs = /*@__PURE__*/ require('node:fs')
313312
}
314313
return _fs as typeof import('fs')
315314
}
@@ -327,7 +326,7 @@ function getPath() {
327326
if (_path === undefined) {
328327
// Use non-'node:' prefixed require to avoid Webpack errors.
329328

330-
_path = /*@__PURE__*/ require('path')
329+
_path = /*@__PURE__*/ require('node:path')
331330
}
332331
return _path as typeof import('path')
333332
}

0 commit comments

Comments
 (0)