Skip to content

Commit

Permalink
Fix lint command usage by husky and required files (#189)
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
bbugh authored and jaredpalmer committed Sep 2, 2019
1 parent c6d2ef3 commit 8197e0f
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ prog
peerDependencies: template === 'react' ? { react: '>=16' } : {},
husky: {
hooks: {
'pre-commit': 'pretty-quick --staged',
'pre-commit': 'tsdx lint',
},
},
prettier: {
Expand All @@ -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 = [
Expand Down Expand Up @@ -493,14 +485,20 @@ 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;
'ignore-pattern': string;
'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({
Expand Down

0 comments on commit 8197e0f

Please sign in to comment.