Skip to content

Commit 43bc3e6

Browse files
committed
style: add eslint ignores for bare Node.js imports
Add eslint-disable-next-line n/prefer-node-protocol comments for all bare Node.js built-in imports. These bare imports (without 'node:' prefix) are intentional for better bundler compatibility, specifically to avoid Webpack bundling errors.
1 parent cfbfdbc commit 43bc3e6

File tree

11 files changed

+22
-0
lines changed

11 files changed

+22
-0
lines changed

src/constants/platform.ts

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

5+
// eslint-disable-next-line n/prefer-node-protocol
56
import { platform } from 'os'
67

78
// Platform detection.

src/cover/code.ts

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

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

78
import { readJson } from '../fs'

src/dlx-binary.ts

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

3+
// eslint-disable-next-line n/prefer-node-protocol
34
import { createHash } from 'crypto'
5+
// eslint-disable-next-line n/prefer-node-protocol
46
import os from 'os'
7+
// eslint-disable-next-line n/prefer-node-protocol
58
import path from 'path'
69

710
import { WIN32 } from '#constants/platform'
@@ -28,6 +31,7 @@ let _fs: typeof import('fs') | undefined
2831
function getFs() {
2932
if (_fs === undefined) {
3033
// Use non-'node:' prefixed require to avoid Webpack errors.
34+
// eslint-disable-next-line n/prefer-node-protocol
3135
_fs = /*@__PURE__*/ require('fs')
3236
}
3337
return _fs as typeof import('fs')

src/dlx-package.ts

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

33+
// eslint-disable-next-line n/prefer-node-protocol
3334
import path from 'path'
3435

3536
import { WIN32 } from './constants/platform'
@@ -54,6 +55,7 @@ let _fs: typeof import('fs') | undefined
5455
function getFs() {
5556
if (_fs === undefined) {
5657
// Use non-'node:' prefixed require to avoid Webpack errors.
58+
// eslint-disable-next-line n/prefer-node-protocol
5759
_fs = /*@__PURE__*/ require('fs')
5860
}
5961
return _fs as typeof import('fs')

src/dlx.ts

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

3+
// eslint-disable-next-line n/prefer-node-protocol
34
import { createHash } from 'crypto'
45

56
import { readDirNamesSync, safeDelete, safeMkdir, safeMkdirSync } from './fs'
@@ -19,6 +20,7 @@ let _fs: typeof import('fs') | undefined
1920
function getFs() {
2021
if (_fs === undefined) {
2122
// Use non-'node:' prefixed require to avoid Webpack errors.
23+
// eslint-disable-next-line n/prefer-node-protocol
2224
_fs = /*@__PURE__*/ require('fs')
2325
}
2426
return _fs as typeof import('fs')

src/download-lock.ts

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

12+
// eslint-disable-next-line n/prefer-node-protocol
1213
import { existsSync } from 'fs'
14+
// eslint-disable-next-line n/prefer-node-protocol
1315
import { mkdir, readFile, rm, stat, writeFile } from 'fs/promises'
16+
// eslint-disable-next-line n/prefer-node-protocol
1417
import { dirname, join } from 'path'
1518
import type { HttpDownloadOptions, HttpDownloadResult } from './http-request'
1619
import { httpDownload } from './http-request'

src/env/rewire.ts

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

12+
// eslint-disable-next-line n/prefer-node-protocol
1213
import { AsyncLocalStorage } from 'async_hooks'
1314

1415
type EnvOverrides = Map<string, string | undefined>

src/fs.ts

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

6+
// eslint-disable-next-line n/prefer-node-protocol
67
import type { Abortable } from 'events'
8+
// eslint-disable-next-line n/prefer-node-protocol
79
import type {
810
Dirent,
911
MakeDirectoryOptions,

src/git.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// eslint-disable-next-line n/prefer-node-protocol
12
import path from 'path'
23

34
import { WIN32 } from '#constants/platform'

src/http-request.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414
* - Zero dependencies on external HTTP libraries.
1515
*/
1616

17+
// eslint-disable-next-line n/prefer-node-protocol
1718
import { createWriteStream } from 'fs'
1819

20+
// eslint-disable-next-line n/prefer-node-protocol
1921
import type { IncomingMessage } from 'http'
2022

2123
let _http: typeof import('http') | undefined

0 commit comments

Comments
 (0)