Skip to content

Commit 447596a

Browse files
committed
fix: update Biome and ESLint configs for bracket notation support
Update linting configuration to support TypeScript bracket notation for index signature properties: - Disable Biome rules: useLiteralKeys, noParameterAssign, noNonNullAssertion, noExplicitAny, noAsyncPromiseExecutor, noAssignInExpressions, useIterableCallbackReturn, noBannedTypes - Disable ESLint rules: no-unexpected-multiline, sort-imports - Remove 103 now-unnecessary biome-ignore suppression comments This aligns with socket-sdk-js and enables TypeScript TS4111 compliance.
1 parent e97942d commit 447596a

25 files changed

+14
-104
lines changed

.config/eslint.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ function configs(sourceType) {
132132
// patterns used in package.json "files" fields. In those cases we simplify
133133
// the glob patterns used.
134134
'n/no-unpublished-bin': 'error',
135+
'no-unexpected-multiline': 'off',
135136
'n/no-unsupported-features/es-builtins': [
136137
'error',
137138
{

biome.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,12 @@
6161
"linter": {
6262
"rules": {
6363
"complexity": {
64+
"noBannedTypes": "off",
6465
"useLiteralKeys": "off"
6566
},
6667
"style": {
67-
"noParameterAssign": "error",
68+
"noParameterAssign": "off",
69+
"noNonNullAssertion": "off",
6870
"useAsConstAssertion": "error",
6971
"useDefaultParameterLast": "error",
7072
"useEnumInitializers": "error",
@@ -75,6 +77,12 @@
7577
"noInferrableTypes": "off",
7678
"noUselessElse": "error",
7779
"useNumericSeparators": "error"
80+
},
81+
"suspicious": {
82+
"noExplicitAny": "off",
83+
"noAsyncPromiseExecutor": "off",
84+
"noAssignInExpressions": "off",
85+
"useIterableCallbackReturn": "off"
7886
}
7987
}
8088
},

src/abort.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export function createCompositeAbortSignal(
1515
}
1616

1717
if (validSignals.length === 1) {
18-
// biome-ignore lint/style/noNonNullAssertion: Length check ensures array has exactly one element.
1918
return validSignals[0]!
2019
}
2120

src/argv/parse.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@ export function getPositionalArgs(startIndex = 2): string[] {
245245
let i = 0
246246

247247
while (i < args.length) {
248-
// biome-ignore lint/style/noNonNullAssertion: Loop condition ensures index is within bounds.
249248
const arg = args[i]!
250249
// Stop at first flag
251250
if (arg.startsWith('-')) {

src/bin.ts

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ function getFs() {
2424

2525
_fs = /*@__PURE__*/ require('node:fs')
2626
}
27-
// biome-ignore lint/style/noNonNullAssertion: Initialized above.
2827
return _fs!
2928
}
3029

@@ -39,7 +38,6 @@ function getPath() {
3938

4039
_path = /*@__PURE__*/ require('node:path')
4140
}
42-
// biome-ignore lint/style/noNonNullAssertion: Initialized above.
4341
return _path!
4442
}
4543

@@ -52,7 +50,6 @@ function getWhich() {
5250
if (_which === undefined) {
5351
_which = /*@__PURE__*/ require('./external/which')
5452
}
55-
// biome-ignore lint/style/noNonNullAssertion: Initialized above.
5653
return _which!
5754
}
5855

@@ -80,8 +77,7 @@ export async function execBin(
8077

8178
// Execute the binary directly.
8279
const binCommand = Array.isArray(resolvedPath)
83-
? // biome-ignore lint/style/noNonNullAssertion: which always returns non-empty array.
84-
resolvedPath[0]!
80+
? resolvedPath[0]!
8581
: resolvedPath
8682
return await spawn(binCommand, args ?? [], options)
8783
}
@@ -311,14 +307,12 @@ export function resolveBinPathSync(binPath: string): string {
311307
try {
312308
const resolved = whichBinSync(binPath)
313309
if (resolved) {
314-
// biome-ignore lint/style/noParameterAssign: Reassigning for normalization.
315310
binPath = resolved as string
316311
}
317312
} catch {}
318313
}
319314

320315
// Normalize the path once for consistent pattern matching.
321-
// biome-ignore lint/style/noParameterAssign: Normalizing path for consistent handling.
322316
binPath = normalizePath(binPath)
323317

324318
// Handle empty string that normalized to '.' (current directory)
@@ -339,9 +333,7 @@ export function resolveBinPathSync(binPath: string): string {
339333
const voltaPlatform = readJsonSync(
340334
path?.join(voltaUserPath, 'platform.json'),
341335
{ throws: false },
342-
) as
343-
// biome-ignore lint/suspicious/noExplicitAny: Volta platform config structure is dynamic.
344-
any
336+
) as any
345337
const voltaNodeVersion = voltaPlatform?.node?.runtime
346338
const voltaNpmVersion = voltaPlatform?.node?.npm
347339
let voltaBinPath = ''
@@ -367,9 +359,7 @@ export function resolveBinPathSync(binPath: string): string {
367359
const binInfo = readJsonSync(
368360
path?.join(voltaUserBinPath, `${basename}.json`),
369361
{ throws: false },
370-
) as
371-
// biome-ignore lint/suspicious/noExplicitAny: Volta bin info structure is dynamic.
372-
any
362+
) as any
373363
const binPackage = binInfo?.package
374364
if (binPackage) {
375365
voltaBinPath = path?.join(
@@ -581,7 +571,6 @@ export function resolveBinPathSync(binPath: string): string {
581571
relPath = /(?<="\$basedir\/).*(?=" $args\n)/.exec(source)?.[0] || ''
582572
}
583573
if (relPath) {
584-
// biome-ignore lint/style/noParameterAssign: Resolving wrapper script target.
585574
binPath = normalizePath(path?.resolve(path?.dirname(binPath), relPath))
586575
}
587576
}
@@ -607,7 +596,6 @@ export function resolveBinPathSync(binPath: string): string {
607596
const stats = fs?.statSync(baseBinPath)
608597
// Only use this path if it's a file (the shell script).
609598
if (stats.isFile()) {
610-
// biome-ignore lint/style/noParameterAssign: Fixing pnpm nested bin structure.
611599
binPath = normalizePath(baseBinPath)
612600
// Recompute hasNoExt since we changed the path.
613601
hasNoExt = !path?.extname(binPath)
@@ -670,7 +658,6 @@ export function resolveBinPathSync(binPath: string): string {
670658

671659
if (relPath) {
672660
// Resolve the relative path to handle .. segments properly.
673-
// biome-ignore lint/style/noParameterAssign: Resolving shell script target.
674661
binPath = normalizePath(path?.resolve(path?.dirname(binPath), relPath))
675662
}
676663
}

src/cacache.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export interface GetOptions {
1111
export interface PutOptions {
1212
integrity?: string | undefined
1313
size?: number | undefined
14-
// biome-ignore lint/suspicious/noExplicitAny: User-provided arbitrary metadata.
1514
metadata?: any | undefined
1615
memoize?: boolean | undefined
1716
}
@@ -20,7 +19,6 @@ export interface CacheEntry {
2019
data: Buffer
2120
integrity: string
2221
key: string
23-
// biome-ignore lint/suspicious/noExplicitAny: User-provided arbitrary metadata.
2422
metadata?: any | undefined
2523
path: string
2624
size: number
@@ -172,7 +170,6 @@ export async function get(
172170
'Cache key cannot contain wildcards (*). Wildcards are only supported in clear({ prefix: "pattern*" }).',
173171
)
174172
}
175-
// biome-ignore lint/suspicious/noExplicitAny: cacache types are incomplete.
176173
const cacache = getCacache() as any
177174
return await cacache.get(getSocketCacacheDir(), key, options)
178175
}
@@ -207,7 +204,6 @@ export async function remove(key: string): Promise<unknown> {
207204
'Cache key cannot contain wildcards (*). Use clear({ prefix: "pattern*" }) to remove multiple entries.',
208205
)
209206
}
210-
// biome-ignore lint/suspicious/noExplicitAny: cacache types are incomplete.
211207
const cacache = getCacache() as any
212208
return await cacache.rm.entry(getSocketCacacheDir(), key)
213209
}
@@ -238,7 +234,6 @@ export async function withTmp<T>(
238234
return (await cacache.tmp.withTmp(
239235
getSocketCacacheDir(),
240236
{},
241-
// biome-ignore lint/suspicious/noExplicitAny: cacache types are incomplete.
242237
callback as any,
243238
)) as T
244239
}

src/cache-with-ttl.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ export function createTtlCache(options?: TtlCacheOptions): TtlCache {
176176
}
177177

178178
// In-memory cache for hot data
179-
// biome-ignore lint/suspicious/noExplicitAny: Generic cache for any value type.
180179
const memoCache = new Map<string, TtlCacheEntry<any>>()
181180

182181
// Ensure ttl is defined
@@ -192,10 +191,7 @@ export function createTtlCache(options?: TtlCacheOptions): TtlCache {
192191
/**
193192
* Check if entry is expired.
194193
*/
195-
function isExpired(
196-
// biome-ignore lint/suspicious/noExplicitAny: Generic check for any entry type.
197-
entry: TtlCacheEntry<any>,
198-
): boolean {
194+
function isExpired(entry: TtlCacheEntry<any>): boolean {
199195
return Date.now() > entry.expiresAt
200196
}
201197

@@ -294,7 +290,6 @@ export function createTtlCache(options?: TtlCacheOptions): TtlCache {
294290

295291
// Check persistent cache for entries not in memory.
296292
const cacheDir = (await import('./paths')).getSocketCacacheDir()
297-
// biome-ignore lint/suspicious/noExplicitAny: cacache types are incomplete.
298293
const cacacheModule = (await import('./cacache')) as any
299294
const stream = cacacheModule.getCacache().ls.stream(cacheDir)
300295

src/dlx.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ function getPath() {
1919

2020
_path = /*@__PURE__*/ require('node:path')
2121
}
22-
// biome-ignore lint/style/noNonNullAssertion: Initialized above.
2322
return _path!
2423
}
2524

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
declare const extensions: {
2-
// biome-ignore lint/suspicious/noExplicitAny: External third-party type definition
32
packageExtensions: any[]
43
}
54
export = extensions

src/external/cacache.d.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ declare namespace Cacache {
88
interface PutOptions {
99
integrity?: string | undefined
1010
size?: number | undefined
11-
// biome-ignore lint/suspicious/noExplicitAny: External third-party type definition
1211
metadata?: any | undefined
1312
memoize?: boolean | undefined
1413
}
@@ -17,7 +16,6 @@ declare namespace Cacache {
1716
data: Buffer
1817
integrity: string
1918
key: string
20-
// biome-ignore lint/suspicious/noExplicitAny: External third-party type definition
2119
metadata?: any | undefined
2220
path: string
2321
size: number
@@ -30,7 +28,6 @@ declare namespace Cacache {
3028
path: string
3129
time: number
3230
size: number
33-
// biome-ignore lint/suspicious/noExplicitAny: External third-party type definition
3431
metadata?: any | undefined
3532
}
3633
}
@@ -79,14 +76,10 @@ declare const cacache: {
7976
tmp: {
8077
withTmp: (
8178
cache: string,
82-
// biome-ignore lint/suspicious/noExplicitAny: External third-party type definition
8379
opts: any,
84-
// biome-ignore lint/suspicious/noExplicitAny: External third-party type definition
8580
callback: (tmpDirPath: string) => Promise<any>,
86-
// biome-ignore lint/suspicious/noExplicitAny: External third-party type definition
8781
) => Promise<any>
8882
}
89-
// biome-ignore lint/suspicious/noExplicitAny: External third-party type definition
9083
[key: string]: any
9184
}
9285

0 commit comments

Comments
 (0)