diff --git a/lint-staged.config.js b/lint-staged.config.js index 552c8bb..ac53f43 100644 --- a/lint-staged.config.js +++ b/lint-staged.config.js @@ -1,3 +1,12 @@ module.exports = { - "*.{js,jsx,ts,tsx}": () => "run-s check:* lint" + "*.{js,jsx,ts,tsx}": filenames => { + // Escape filenames and join by space + const joinedFilenames = filenames.map(str => `"${str}"`).join(" "); + return [ + "run-s check:!(format)", + `npm run check:format -- ${joinedFilenames}`, + `npm run _lint -- ${joinedFilenames}` + ]; + // `run-s check:!(format) "check:format -- ${joinedFilenames}" "_lint -- ${joinedFilenames}"`; + } }; diff --git a/package.json b/package.json index 4d843bb..5020365 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,8 @@ "compile": "tsc -p tsconfig.base.json", "docs": "npx typedoc ./src/", "format": "prettier --write \"**/*.{js,ts,tsx}\"", - "lint": "eslint . --ext .js,.ts,.jsx,.tsx", + "_lint": "eslint --ext .js,.ts,.jsx,.tsx", + "lint": "npm run _lint -- .", "postbundle": "del compiled && cp-cli ./index.js ./dist/index.js", "postversion": "git push && git push --tags && npm publish", "release": "npm version -m 'Release v%s'",