Skip to content

Commit

Permalink
Fix ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker committed Aug 6, 2021
1 parent 6cc5d1c commit 7e0bafd
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};

Expand Down Expand Up @@ -165,7 +170,7 @@ const lintFiles = async (patterns, inputOptions = {}) => {
},
);

return mergeReports(reports);
return mergeReports(reports.filter(Boolean));
};

const getFormatter = async name => {
Expand Down

0 comments on commit 7e0bafd

Please sign in to comment.