Skip to content

Commit b5ab939

Browse files
authored
fix: skip if eslint is not installed (#7)
1 parent 8b20e05 commit b5ab939

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/index.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,19 @@ export default (api: IApi) => {
1111
api?.config?.esm?.input || api?.config?.esm?.input || 'src/';
1212

1313
const { execSync } = require('child_process');
14-
execSync(
15-
`npx eslint ${inputFolder} --ext .tsx,.ts --rule '@typescript-eslint/consistent-type-exports: error'`,
16-
{
17-
cwd: process.cwd(),
18-
env: process.env,
19-
stdio: [process.stdin, process.stdout, process.stderr],
20-
encoding: 'utf-8',
21-
},
22-
);
14+
try {
15+
execSync(
16+
`npx eslint ${inputFolder} --ext .tsx,.ts --rule '@typescript-eslint/consistent-type-exports: error'`,
17+
{
18+
cwd: process.cwd(),
19+
env: process.env,
20+
stdio: [process.stdin, process.stdout, process.stderr],
21+
encoding: 'utf-8',
22+
},
23+
);
24+
} catch (error) {
25+
console.log('ESLint is not installed, skip.');
26+
}
2327
});
2428

2529
// modify default build config for all rc projects

0 commit comments

Comments
 (0)