From b6267b5ab7955551ded52d8867e5446f7afbd7a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Sat, 1 Dec 2018 14:17:40 +0800 Subject: [PATCH] support pretier info ignored --- package.json | 2 +- scripts/lint-prettier.js | 3 +++ scripts/prettier.js | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 46eda13d..0fb22b41 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 ad825a1a..7d4d5cd5 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 b4dbef34..c7e8cf80 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 = { -- GitLab