Fix bin/publish: use correct .env path for rspade_system Fix bin/publish script: prevent grep exit code 1 from terminating script 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
50 lines
1.2 KiB
JavaScript
Executable File
50 lines
1.2 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
/**
|
|
* JavaScript Syntax Linter for Code Quality Checks
|
|
*
|
|
* This script checks JavaScript files for syntax errors using acorn parser.
|
|
*
|
|
* Usage: node js-linter.js <input-file>
|
|
* Exit codes:
|
|
* 0 - No syntax errors
|
|
* 1 - Syntax error found
|
|
*/
|
|
|
|
const fs = require('fs');
|
|
const acorn = require('acorn');
|
|
|
|
// Get input file from command line arguments
|
|
const inputFile = process.argv[2];
|
|
|
|
if (!inputFile) {
|
|
console.error('Usage: node js-linter.js <input-file>');
|
|
process.exit(1);
|
|
}
|
|
|
|
try {
|
|
const code = fs.readFileSync(inputFile, 'utf8');
|
|
|
|
// Parse the code to check for syntax errors
|
|
acorn.parse(code, {
|
|
ecmaVersion: 'latest',
|
|
sourceType: 'module',
|
|
allowReturnOutsideFunction: true,
|
|
allowImportExportEverywhere: true,
|
|
allowAwaitOutsideFunction: true,
|
|
allowSuperOutsideMethod: true,
|
|
allowHashBang: true
|
|
});
|
|
|
|
// Silent success - no output when no errors
|
|
process.exit(0);
|
|
|
|
} catch (error) {
|
|
// Output error information
|
|
console.error('Syntax error: ' + error.message);
|
|
if (error.loc) {
|
|
console.error('Line: ' + error.loc.line);
|
|
console.error('Column: ' + error.loc.column);
|
|
}
|
|
process.exit(1);
|
|
} |