Skip to content

Commit 5f9f918

Browse files
committed
feat(check): delegate linting to lint command for consistency
Aligns check.mjs with standard pattern across socket-* repos: - check.mjs now delegates to `pnpm run lint` with appropriate flags - Removes running eslint directly - Adds --all and --staged flag support - Lint command is single source of truth for linting behavior
1 parent cc51f34 commit 5f9f918

File tree

1 file changed

+36
-10
lines changed

1 file changed

+36
-10
lines changed

scripts/check.mjs

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
/**
22
* @fileoverview Check script for the registry.
33
* Runs all quality checks in parallel:
4-
* - ESLint
4+
* - Linting (via lint command)
55
* - TypeScript type checking
66
*
77
* Usage:
8-
* node scripts/check.mjs
8+
* node scripts/check.mjs [options]
9+
*
10+
* Options:
11+
* --all Run on all files (default behavior)
12+
* --staged Run on staged files only
913
*/
1014

1115
import { existsSync } from 'node:fs'
@@ -25,6 +29,27 @@ const registryDistPath = path.join(rootPath, 'registry', 'dist', 'index.js')
2529

2630
async function main() {
2731
try {
32+
const all = process.argv.includes('--all')
33+
const staged = process.argv.includes('--staged')
34+
const help = process.argv.includes('--help') || process.argv.includes('-h')
35+
36+
if (help) {
37+
logger.log('Check Runner')
38+
logger.log('\nUsage: node scripts/check.mjs [options]')
39+
logger.log('\nOptions:')
40+
logger.log(' --help, -h Show this help message')
41+
logger.log(' --all Run on all files (default behavior)')
42+
logger.log(' --staged Run on staged files only')
43+
logger.log('\nExamples:')
44+
logger.log(' node scripts/check.mjs # Run on all files')
45+
logger.log(
46+
' node scripts/check.mjs --all # Run on all files (explicit)',
47+
)
48+
logger.log(' node scripts/check.mjs --staged # Run on staged files')
49+
process.exitCode = 0
50+
return
51+
}
52+
2853
printHeader('Running Checks')
2954

3055
// Build @socketsecurity/registry if not already built.
@@ -38,16 +63,17 @@ async function main() {
3863
}
3964
}
4065

66+
// Delegate to lint command with appropriate flags
67+
const lintArgs = ['run', 'lint']
68+
if (all) {
69+
lintArgs.push('--all')
70+
} else if (staged) {
71+
lintArgs.push('--staged')
72+
}
73+
4174
const checks = [
4275
{
43-
args: [
44-
'exec',
45-
'eslint',
46-
'--config',
47-
'.config/eslint.config.mjs',
48-
'--report-unused-disable-directives',
49-
'.',
50-
],
76+
args: lintArgs,
5177
command: 'pnpm',
5278
options: {
5379
...(process.platform === 'win32' && { shell: true }),

0 commit comments

Comments
 (0)