Skip to content

Commit a7a5a58

Browse files
committed
Fix bugs in lint script
1 parent bab325a commit a7a5a58

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"author": "Christos Dimitroulas",
2525
"license": "ISC",
2626
"dependencies": {
27-
"@types/node": "^12.7.2",
27+
"@typescript-eslint/eslint-plugin": "^2.0.0",
28+
"@typescript-eslint/parser": "^2.0.0",
2829
"cross-spawn": "^6.0.5",
2930
"eslint": "^6.2.2",
3031
"eslint-config-prettier": "^6.1.0",
@@ -35,9 +36,8 @@
3536
},
3637
"devDependencies": {
3738
"@types/cross-spawn": "^6.0.0",
39+
"@types/node": "^12.7.2",
3840
"@types/yargs-parser": "^13.0.0",
39-
"@typescript-eslint/eslint-plugin": "^2.0.0",
40-
"@typescript-eslint/parser": "^2.0.0",
4141
"np": "^5.0.3"
4242
},
4343
"bin": "./lib/index.js",

scripts/lint.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import spawn from "cross-spawn";
44
import yargsParser from "yargs-parser";
55

66
const appDirectory = fs.realpathSync(process.cwd());
7-
const args = process.argv.slice(2);
7+
const args = process.argv.slice(3);
88
const parsedArgs = yargsParser(args);
99

1010
function lint(): number {
@@ -13,12 +13,16 @@ function lint(): number {
1313
const otherArgs = args.filter(arg => !parsedArgs._.includes(arg));
1414

1515
const result = spawn.sync(
16-
path.join(__dirname, "../node_modules/.bin/eslint"),
16+
path.join(appDirectory, "./node_modules/.bin/eslint"),
1717
["--config", configPath, "--ext", ".js,.ts", ...otherArgs, ...filesToLint],
1818
{ stdio: "inherit" }
1919
);
2020

21-
return result.status ? result.status : 0;
21+
if (result.error) {
22+
console.error(result.error)
23+
}
24+
25+
return typeof result.status === 'number' ? result.status : 1;
2226
}
2327

2428
function getEslintConfigPath(): string {

0 commit comments

Comments
 (0)