From 8197e0f2fd331870a6cd2cb4d0807ce6b41617e5 Mon Sep 17 00:00:00 2001 From: Brian Bugh Date: Mon, 2 Sep 2019 14:30:17 -0500 Subject: [PATCH] Fix lint command usage by husky and required files (#189) - Fixes the husky pre-commit hook not using the `tsdx lint` command - Fixes `tsdx lint` without any input files failing with a help message instead of silently appearing to succeed. Related to #7 --- src/index.ts | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/index.ts b/src/index.ts index 45053e6be..53eb7b076 100755 --- a/src/index.ts +++ b/src/index.ts @@ -254,7 +254,7 @@ prog peerDependencies: template === 'react' ? { react: '>=16' } : {}, husky: { hooks: { - 'pre-commit': 'pretty-quick --staged', + 'pre-commit': 'tsdx lint', }, }, prettier: { @@ -273,15 +273,7 @@ prog process.exit(1); } - let deps = [ - '@types/jest', - 'husky', - 'pretty-quick', - 'prettier', - 'tsdx', - 'tslib', - 'typescript', - ].sort(); + let deps = ['@types/jest', 'husky', 'tsdx', 'tslib', 'typescript'].sort(); if (template === 'react') { deps = [ @@ -493,7 +485,7 @@ prog .option('--ignore-pattern', 'Ignore a pattern') .example('lint src test --ignore-pattern test/foobar.ts') .option('--write-file', 'Write the config file locally') - .example('lint src test --write-file') + .example('lint --write-file') .action( async (opts: { fix: boolean; @@ -501,6 +493,12 @@ prog 'write-file': boolean; _: string[]; }) => { + if (opts['_'].length === 0) { + prog.help('lint'); + console.log(chalk.red('No input files specified.')); + process.exit(1); + } + const cli = new CLIEngine({ baseConfig: { ...createEslintConfig({