From 228eed8f5c60a8299e95d0e618ab17069c079106 Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Fri, 6 Aug 2021 14:19:19 +0800 Subject: [PATCH] Fix ignore --- index.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index e6dda6f2..9aadc80b 100644 --- a/index.js +++ b/index.js @@ -82,14 +82,19 @@ const processReport = (report, {isQuiet = false} = {}) => { return result; }; -const runEslint = async (file, options, processorOptions) => { +const runEslint = async (filePath, options, processorOptions) => { + const filename = path.relative(options.cwd, filePath); const engine = new ESLint(options); - if (await engine.isPathIgnored(file)) { - return getEmptyReport(file); + if ( + micromatch.isMatch(filename, options.baseConfig.ignorePatterns) + || isGitIgnoredSync({cwd: options.cwd, ignore: options.baseConfig.ignorePatterns})(filePath) + || await engine.isPathIgnored(filePath) + ) { + return; } - const report = await engine.lintFiles([file]); + const report = await engine.lintFiles([filePath]); return processReport(report, processorOptions); };