diff --git a/src/scripts/lint.ts b/src/scripts/lint.ts index e9fbe7fa..f920b880 100644 --- a/src/scripts/lint.ts +++ b/src/scripts/lint.ts @@ -41,8 +41,8 @@ function getLintAllCommands(options: Options): string[] { return [ 'prettier . --ignore-unknown' + (options.fix ? ' --write' : ' --check'), 'eslint . --config src/.eslintrc.js' + (options.fix ? ' --fix' : ''), - // TODO(goodov): Add a command to lint JSON studies when per-file structure - // appears. + // TODO(goodov): Enable when per-file structure appears. + // 'npm run seed_tools lint --' + (options.fix ? ' --fix' : ''), ]; } @@ -53,7 +53,7 @@ function getLintDiffCommands(options: Options): Record { '*.{ts,js,tsx,jsx}': 'eslint --config src/.eslintrc.js' + (options.fix ? ' --fix' : ''), 'studies/*': () => - 'npm run seed_tools -- lint studies' + (options.fix ? ' --fix' : ''), + 'npm run seed_tools lint --' + (options.fix ? ' --fix' : ''), }; } diff --git a/src/seed_tools/commands/create.ts b/src/seed_tools/commands/create.ts index 58e32f7b..ff3bc6f8 100644 --- a/src/seed_tools/commands/create.ts +++ b/src/seed_tools/commands/create.ts @@ -12,8 +12,12 @@ import { readStudiesToSeed } from '../utils/studies_to_seed'; export default function createCommand() { return new Command('create') .description('Create seed.bin from study files') - .argument('', 'path to the directory containing study files') - .argument('', 'output seed file') + .argument( + '[studies_dir]', + 'path to the directory containing study files', + 'studies', + ) + .argument('[output_seed_file]', 'output seed file', 'seed.bin') .option('--mock_serial_number ', 'mock serial number') .option( '--output_serial_number_file ', diff --git a/src/seed_tools/commands/lint.ts b/src/seed_tools/commands/lint.ts index 9108deae..166bfddf 100644 --- a/src/seed_tools/commands/lint.ts +++ b/src/seed_tools/commands/lint.ts @@ -9,7 +9,11 @@ import { readStudiesToSeed } from '../utils/studies_to_seed'; export default function createCommand() { return new Command('lint') .description('Lint study files without creating seed.bin') - .argument('', 'path to the directory containing study files') + .argument( + '[studies_dir]', + 'path to the directory containing study files', + 'studies', + ) .option('--fix', 'fix format errors in-place') .action(lintStudies); }