diff --git a/package.json b/package.json index 46eda13d1827f196bd3bda886e832be3a8bad064..0fb22b415b3e4bf4f7b89c42898ead480decd29a 100644 --- a/package.json +++ b/package.json @@ -99,7 +99,7 @@ "puppeteer": "^1.10.0" }, "lint-staged": { - "**/*.{js,jsx,less}": [ + "**/*.{js,ts,tsx,json,jsx,less}": [ "node ./scripts/lint-prettier.js", "git add" ], diff --git a/scripts/lint-prettier.js b/scripts/lint-prettier.js index ad825a1a3238f49407793138f3a8431e213d2f22..7d4d5cd503c2398f463bc443de67ea853b2c1830 100644 --- a/scripts/lint-prettier.js +++ b/scripts/lint-prettier.js @@ -22,6 +22,9 @@ files.forEach(file => { }); try { const fileInfo = prettier.getFileInfo.sync(file); + if (fileInfo.ignored) { + return; + } const input = fs.readFileSync(file, 'utf8'); const withParserOptions = { ...options, diff --git a/scripts/prettier.js b/scripts/prettier.js index b4dbef34ac97fc8ee02b252eb0a5bd9241ff959c..c7e8cf80c082ba9eff435e770204509d2e62bf82 100644 --- a/scripts/prettier.js +++ b/scripts/prettier.js @@ -27,6 +27,9 @@ files.forEach(file => { config: prettierConfigPath, }); const fileInfo = prettier.getFileInfo.sync(file); + if (fileInfo.ignored) { + return; + } try { const input = fs.readFileSync(file, 'utf8'); const withParserOptions = {