Skip to content

Commit

Permalink
Correctly handle ignored files for autofix with stdin
Browse files Browse the repository at this point in the history
  • Loading branch information
mahmost committed Oct 30, 2017
1 parent 54d516c commit 9590b3d
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions lib/standalone.js
Expand Up @@ -120,8 +120,19 @@ module.exports = function(
.then(stylelintResult => {
const returnValue = prepareReturnValue([stylelintResult]);
const postcssResult = stylelintResult._postcssResult;
// If we're fixing the output should be the fixed code
if (options.fix && !postcssResult.stylelint.ignored) {
// if file is ignored, return nothing
if (
absoluteCodeFilename &&
!ignorer.filter(path.relative(process.cwd(), absoluteCodeFilename))
.length
) {
returnValue.output = "";
} else if (
options.fix &&
postcssResult &&
!postcssResult.stylelint.ignored
) {
// If we're fixing, the output should be the fixed code
returnValue.output = postcssResult.root.toString(
postcssResult.opts.syntax
);
Expand Down

0 comments on commit 9590b3d

Please sign in to comment.