From 9fd2b6f5fa6131f6185ecc7286705961c1ffe901 Mon Sep 17 00:00:00 2001 From: Peter Pan Date: Sat, 7 Mar 2020 14:39:10 +0800 Subject: [PATCH] fix: make lint-staged great again (#577) --- frontend/lint-staged.config.js | 8 ++++++-- frontend/package.json | 2 +- frontend/tsconfig.json | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/frontend/lint-staged.config.js b/frontend/lint-staged.config.js index 29adbcdd..9df9e3a9 100644 --- a/frontend/lint-staged.config.js +++ b/frontend/lint-staged.config.js @@ -1,4 +1,8 @@ module.exports = { - '**/*.ts?(x)': () => ['tsc -p tsconfig.json --noEmit', 'eslint'], - '**/*.js?(x)': () => 'eslint' + '**/*.ts?(x)': filenames => [ + 'tsc -p tsconfig.json --noEmit', + 'tsc -p tsconfig.server.json --noEmit', + `eslint ${filenames.join(' ')}` + ], + '**/*.js?(x)': filenames => `eslint ${filenames.join(' ')}` }; diff --git a/frontend/package.json b/frontend/package.json index 85e4d021..3ebf7883 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -30,7 +30,7 @@ "build": "./scripts/build.sh", "export": "yarn build:next && next export", "start": "NODE_ENV=production node dist/server/index.js", - "lint": "tsc --noEmit && eslint --ext .tsx,.jsx.ts,.js --ignore-path .gitignore .", + "lint": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.server.json --noEmit && eslint --ext .tsx,.jsx.ts,.js --ignore-path .gitignore .", "format": "prettier --write \"**/*.ts\" \"**/*.tsx\" \"**/*.js\" \"**/*.jsx\"", "test": "echo \"Error: no test specified\" && exit 0" }, diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json index 9c01330a..fc8d3ca4 100644 --- a/frontend/tsconfig.json +++ b/frontend/tsconfig.json @@ -29,6 +29,7 @@ "isolatedModules": true }, "exclude": [ + "server", "node_modules" ], "include": [ -- GitLab