Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't parse ignored files #3801

Merged
merged 2 commits into from
Nov 13, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
just to ignore the ignored files before lint, to avoid parse errors…
… in these files.
  • Loading branch information
season committed Nov 10, 2018
commit 9873dffa19a249f6ff31c691c6678bf627a1f72a
20 changes: 10 additions & 10 deletions lib/standalone.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,16 @@ module.exports = function(
? path.join(process.cwd(), codeFilename)
: codeFilename;

// if file is ignored, return nothing
if (
absoluteCodeFilename &&
!filterFilePaths(ignorer, [
path.relative(process.cwd(), absoluteCodeFilename)
]).length
) {
return Promise.resolve(prepareReturnValue([]));
}

return stylelint
._lintSource({
code,
Expand Down Expand Up @@ -143,16 +153,6 @@ module.exports = function(
})
.catch(_.partial(handleError, stylelint))
.then(stylelintResult => {
// if file is ignored, return nothing
if (
absoluteCodeFilename &&
!filterFilePaths(ignorer, [
path.relative(process.cwd(), absoluteCodeFilename)
]).length
) {
return prepareReturnValue([]);
}

const postcssResult = stylelintResult._postcssResult;
const returnValue = prepareReturnValue([stylelintResult]);

Expand Down