Skip to content

Commit 8197e0f

Browse files
bbughjaredpalmer
authored andcommitted
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
1 parent c6d2ef3 commit 8197e0f

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

src/index.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ prog
254254
peerDependencies: template === 'react' ? { react: '>=16' } : {},
255255
husky: {
256256
hooks: {
257-
'pre-commit': 'pretty-quick --staged',
257+
'pre-commit': 'tsdx lint',
258258
},
259259
},
260260
prettier: {
@@ -273,15 +273,7 @@ prog
273273
process.exit(1);
274274
}
275275

276-
let deps = [
277-
'@types/jest',
278-
'husky',
279-
'pretty-quick',
280-
'prettier',
281-
'tsdx',
282-
'tslib',
283-
'typescript',
284-
].sort();
276+
let deps = ['@types/jest', 'husky', 'tsdx', 'tslib', 'typescript'].sort();
285277

286278
if (template === 'react') {
287279
deps = [
@@ -493,14 +485,20 @@ prog
493485
.option('--ignore-pattern', 'Ignore a pattern')
494486
.example('lint src test --ignore-pattern test/foobar.ts')
495487
.option('--write-file', 'Write the config file locally')
496-
.example('lint src test --write-file')
488+
.example('lint --write-file')
497489
.action(
498490
async (opts: {
499491
fix: boolean;
500492
'ignore-pattern': string;
501493
'write-file': boolean;
502494
_: string[];
503495
}) => {
496+
if (opts['_'].length === 0) {
497+
prog.help('lint');
498+
console.log(chalk.red('No input files specified.'));
499+
process.exit(1);
500+
}
501+
504502
const cli = new CLIEngine({
505503
baseConfig: {
506504
...createEslintConfig({

0 commit comments

Comments
 (0)