Skip to content

Commit 5161aed

Browse files
committed
Auto-format all files with Biome
- Remove extra whitespace and empty lines - Standardize import formatting - Fix trailing spaces - All 852 files now pass Biome checks
1 parent 2e9ea3a commit 5161aed

File tree

402 files changed

+1700
-1555
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

402 files changed

+1700
-1555
lines changed

.config/esbuild.cli.build.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
* esbuild build script for Socket CLI.
33
*/
44

5-
import { brotliCompressSync } from 'node:zlib'
65
import { readFileSync, writeFileSync } from 'node:fs'
6+
import { brotliCompressSync } from 'node:zlib'
7+
78
import { build } from 'esbuild'
89

910
import config from './esbuild.cli.config.mjs'
@@ -28,9 +29,8 @@ try {
2829
const jsCode = readFileSync(config.outfile)
2930
const compressed = brotliCompressSync(jsCode, {
3031
params: {
31-
// eslint-disable-next-line n/prefer-global/buffer
3232
[require('node:zlib').constants.BROTLI_PARAM_QUALITY]: 11,
33-
// eslint-disable-next-line n/prefer-global/buffer
33+
3434
[require('node:zlib').constants.BROTLI_PARAM_SIZE_HINT]: jsCode.length,
3535
},
3636
})

CLAUDE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ node scripts/load.mjs <script-name> [flags]
101101
node scripts/load.mjs build-yao-pkg-node --clean
102102
```
103103

104-
**As a loader (also works):**
104+
**As an import (also works):**
105105
```bash
106-
node --loader=./scripts/load.mjs scripts/build-yao-pkg-node.mjs --clean
106+
node --import=./scripts/load.mjs scripts/build-yao-pkg-node.mjs --clean
107107
```
108108

109109
**Benefits:**

bin/bootstrap.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
1-
// eslint-disable-next-line no-restricted-syntax, n/prefer-global/process
1+
const { spawnSync } = require('node:child_process')
22
const { existsSync, readFileSync, writeFileSync } = require('node:fs')
3-
// eslint-disable-next-line no-restricted-syntax, n/prefer-global/process
43
const { homedir, tmpdir } = require('node:os')
5-
// eslint-disable-next-line no-restricted-syntax, n/prefer-global/process
64
const { join } = require('node:path')
7-
// eslint-disable-next-line no-restricted-syntax, n/prefer-global/process
8-
const { spawnSync } = require('node:child_process')
9-
// eslint-disable-next-line no-restricted-syntax, n/prefer-global/process
105
const { brotliDecompressSync } = require('node:zlib')
116

127
const SOCKET_DLX_DIR = join(homedir(), '.socket', '_dlx')
@@ -42,7 +37,6 @@ if (existsSync(CLI_ENTRY_BZ)) {
4237

4338
// Clean up temp file.
4439
try {
45-
// eslint-disable-next-line no-restricted-syntax, n/prefer-global/process
4640
const { unlinkSync } = require('node:fs')
4741
unlinkSync(tempCliPath)
4842
} catch {

scripts/build-custom-node.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
*/
4949

5050
import { existsSync, readdirSync } from 'node:fs'
51-
// eslint-disable-next-line n/no-unsupported-features/node-builtins
5251
import {
5352
copyFile,
5453
cp,

scripts/check-version-consistency.mjs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
#!/usr/bin/env node
2-
31
import { promises as fs } from 'node:fs'
42
import path from 'node:path'
5-
import { fileURLToPath } from 'node:url'
63
import process from 'node:process'
4+
import { fileURLToPath } from 'node:url'
75

86
const __filename = fileURLToPath(import.meta.url)
97
const __dirname = path.dirname(__filename)

scripts/clean.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55

66
import path from 'node:path'
77
import { fileURLToPath } from 'node:url'
8+
9+
import { deleteAsync } from 'del'
10+
import fastGlob from 'fast-glob'
11+
812
import { isQuiet } from '@socketsecurity/lib/argv/flags'
913
import { parseArgs } from '@socketsecurity/lib/argv/parse'
1014
import { logger } from '@socketsecurity/lib/logger'
1115
import { createSectionHeader } from '@socketsecurity/lib/stdio/header'
12-
import { deleteAsync } from 'del'
13-
import fastGlob from 'fast-glob'
1416

1517
const rootPath = path.resolve(
1618
path.dirname(fileURLToPath(import.meta.url)),

scripts/test-wrapper.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010
import { spawn } from 'node:child_process'
1111
import { existsSync } from 'node:fs'
1212
import path from 'node:path'
13+
14+
import fastGlob from 'fast-glob'
15+
1316
import { WIN32 } from '@socketsecurity/lib/constants/platform'
1417
import { logger } from '@socketsecurity/lib/logger'
15-
import fastGlob from 'fast-glob'
1618

1719
import constants from './constants.mjs'
1820

scripts/wasm.mjs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@
1515
* node scripts/wasm.mjs --help
1616
*/
1717

18-
import { existsSync } from 'node:fs'
19-
import { promises as fs } from 'node:fs'
18+
import { existsSync, promises as fs } from 'node:fs'
2019
import path from 'node:path'
2120
import { fileURLToPath } from 'node:url'
2221

23-
import { spawn } from '@socketsecurity/lib/spawn'
2422
import { logger } from '@socketsecurity/lib/logger'
23+
import { spawn } from '@socketsecurity/lib/spawn'
2524

2625
const __dirname = path.dirname(fileURLToPath(import.meta.url))
2726
const rootPath = path.join(__dirname, '..')

scripts/wasm/build-unified-wasm.mjs

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@
1919
* - external/socket-ai-sync.mjs (brotli-compressed, base64-encoded WASM)
2020
*/
2121

22-
import { brotliCompressSync } from 'node:zlib'
23-
import { existsSync } from 'node:fs'
24-
import { promises as fs } from 'node:fs'
22+
import { existsSync, promises as fs } from 'node:fs'
2523
import path from 'node:path'
2624
import { fileURLToPath } from 'node:url'
25+
import { brotliCompressSync } from 'node:zlib'
2726

2827
import { logger } from '@socketsecurity/lib/logger'
2928
import { spawn } from '@socketsecurity/lib/spawn'
@@ -69,7 +68,9 @@ async function installBinaryen() {
6968
const isMacOS = process.platform === 'darwin'
7069
const isLinux = process.platform === 'linux'
7170

72-
logger.progress('Installing binaryen (wasm-opt) - this may take a few minutes')
71+
logger.progress(
72+
'Installing binaryen (wasm-opt) - this may take a few minutes',
73+
)
7374

7475
try {
7576
if (isMacOS) {
@@ -88,7 +89,9 @@ async function installBinaryen() {
8889
logger.substep('Trying apt-get installation')
8990
try {
9091
await exec('sudo', ['apt-get', 'update'], { stdio: 'pipe' })
91-
await exec('sudo', ['apt-get', 'install', '-y', 'binaryen'], { stdio: 'inherit' })
92+
await exec('sudo', ['apt-get', 'install', '-y', 'binaryen'], {
93+
stdio: 'inherit',
94+
})
9295
logger.done('binaryen installed via apt-get')
9396
return true
9497
} catch {
@@ -125,18 +128,22 @@ async function installBinaryen() {
125128

126129
// For CI/automation, we'll gracefully degrade if GitHub releases download fails.
127130
logger.warn('GitHub releases download not yet implemented')
128-
logger.warn('wasm-opt will be skipped (install manually for smaller bundles)')
131+
logger.warn(
132+
'wasm-opt will be skipped (install manually for smaller bundles)',
133+
)
129134
return false
130135
} catch (e) {
131136
logger.error(`Failed to install binaryen: ${e.message}`)
132-
logger.warn('wasm-opt will be skipped (install manually for optimal bundle size)')
137+
logger.warn(
138+
'wasm-opt will be skipped (install manually for optimal bundle size)',
139+
)
133140
return false
134141
}
135142
}
136143

137144
const __dirname = path.dirname(fileURLToPath(import.meta.url))
138145
const rootPath = path.join(__dirname, '../..')
139-
const wasmBundleDir = path.join(rootPath, 'wasm-bundle')
146+
const wasmBundleDir = path.join(rootPath, 'build/wasm-bundle')
140147
const externalDir = path.join(rootPath, 'external')
141148

142149
logger.step('Build Unified WASM Bundle')
@@ -227,9 +234,7 @@ if (!existsSync(wasmFile)) {
227234

228235
let stats = await fs.stat(wasmFile)
229236
const originalSize = stats.size
230-
logger.info(
231-
`WASM bundle size: ${(originalSize / 1024 / 1024).toFixed(2)} MB`,
232-
)
237+
logger.info(`WASM bundle size: ${(originalSize / 1024 / 1024).toFixed(2)} MB`)
233238

234239
// Try to optimize with wasm-opt if available.
235240
try {
@@ -446,16 +451,12 @@ const outputPath = path.join(externalDir, 'socket-ai-sync.mjs')
446451
await fs.writeFile(outputPath, syncContent, 'utf-8')
447452

448453
logger.done(`Generated ${outputPath}`)
449-
logger.done(
450-
`File size: ${(syncContent.length / 1024 / 1024).toFixed(2)} MB`,
451-
)
454+
logger.done(`File size: ${(syncContent.length / 1024 / 1024).toFixed(2)} MB`)
452455

453456
logger.success('Build Complete')
454457

455458
logger.info('Summary:')
456-
logger.info(
457-
` Original WASM: ${(wasmData.length / 1024 / 1024).toFixed(2)} MB`,
458-
)
459+
logger.info(` Original WASM: ${(wasmData.length / 1024 / 1024).toFixed(2)} MB`)
459460
logger.info(
460461
` Compressed: ${(wasmCompressed.length / 1024 / 1024).toFixed(2)} MB`,
461462
)

scripts/wasm/check-rust-toolchain.mjs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
* Uses stable Rust toolchain (auto-updated via rustup).
1212
*/
1313

14-
import { existsSync } from 'node:fs'
15-
import { promises as fs } from 'node:fs'
14+
import { existsSync, promises as fs } from 'node:fs'
1615
import { homedir } from 'node:os'
1716
import path from 'node:path'
1817

@@ -76,7 +75,9 @@ async function checkRustInstalled() {
7675
* Install Rust via rustup (cross-platform).
7776
*/
7877
async function installRust() {
79-
logger.progress('Installing Rust toolchain via rustup (this may take a few minutes)')
78+
logger.progress(
79+
'Installing Rust toolchain via rustup (this may take a few minutes)',
80+
)
8081

8182
const isWindows = WIN32
8283

@@ -101,7 +102,13 @@ async function installRust() {
101102
logger.substep('Running rustup-init.exe')
102103
const result = await exec(
103104
exePath,
104-
['-y', '--default-toolchain', 'stable', '--default-host', 'x86_64-pc-windows-msvc'],
105+
[
106+
'-y',
107+
'--default-toolchain',
108+
'stable',
109+
'--default-host',
110+
'x86_64-pc-windows-msvc',
111+
],
105112
{
106113
stdio: 'inherit',
107114
env: {

0 commit comments

Comments
 (0)