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

gulp-stylelint failing out of gulp process on error #128

Open
matthewmcvickar opened this issue Apr 29, 2020 · 5 comments
Open

gulp-stylelint failing out of gulp process on error #128

matthewmcvickar opened this issue Apr 29, 2020 · 5 comments

Comments

@matthewmcvickar
Copy link

matthewmcvickar commented Apr 29, 2020

When I have a stylelint error, it is failing out of gulp, which means I have to completely restart Gulp every time I make a mistake.

(At first I thought this was a gulp-notify issue, but it persists when gulp-notify is disabled.)

My gulp task:

// Build CSS.
const compileCSS = () => {
  const sassOptions = {
    includePaths: ['node_modules']
  }

  const stylelintOptions = {
    reporters: [
      {
        formatter: 'string',
        console: true
      }
    ]
  }

  return gulp.src(paths.css.src)
    .pipe(stylelint(stylelintOptions))
    .pipe(gulpif(isDev, sourcemaps.init()))
    .pipe(sass(sassOptions))
    .on('error', notify.onError((error) => {
      return error.message;
    }))
    .pipe(postcss([ autoprefixer() ]))
    .pipe(gulpif(isDev, sourcemaps.write()))
    .pipe(gulpif(!isDev, rename({ suffix: '.min' })))
    .pipe(gulp.dest(paths.css.dest))
    .pipe(browserSyncServer.stream())
}

And the terminal output:

[16:02:18] Starting 'compileCSS'...
[16:02:19]

_src/css/global/_images.scss
 90:1   ✖  Expected empty line before comment   scss/double-slash-comment-empty-line-before
 90:13  ✖  Expected a space after //            scss/double-slash-comment-whitespace-inside



[16:02:19] 'compileCSS' errored after 884 ms
[16:02:19] Error in plugin "gulp-stylelint"
Message:
    Failed with 2 errors
Details:
    domainEmitter: [object Object]
    domainThrown: false

This should show a notification on my machine, but it doesn't; it's just failing in the terminal.

I am running the latest of all relevant packages as of this writing:

  • gulp 4.0.2
  • gulp-stylelint 13.0.0
  • stylelint-scss 3.17.2
@matthewmcvickar matthewmcvickar changed the title gulp-stylelint not showing errors with gulp-notify gulp-stylelint not showing notifications for errors with gulp-notify Apr 29, 2020
@matthewmcvickar matthewmcvickar changed the title gulp-stylelint not showing notifications for errors with gulp-notify gulp-stylelint failing out of gulp process on error May 6, 2020
@finteractive
Copy link

finteractive commented Feb 17, 2021

I'm also having the same issue.

gulp.task('sass:stylelint', function () {
  var src = config.sass.watchSrc;
  if (config.sass.lint.extraSrc) {
    src = src.concat(config.sass.lint.extraSrc);
  }
  return gulp.src(src)
    .pipe(gulp.$.stylelint({
      reporters: [
        {
          formatter: 'string', 
          console: true,
          failAfterError: false,
        }

      ]
    }))
});

gulp 4.0.2
gulp-stylelint 13.0.0
stylelint-scss 3.18

@danparm
Copy link

danparm commented Feb 19, 2021

Getting the same error as well. Running stylelint with the CL runs just fine. Using the default gulp-stylelint implementation from the readme. Stylelint config just the default as well.

gulp 4.0.2
gulp-stylelint 13.0.0
stylelint 13.10.0
stylelint-config-standard 20.0.0

@ronilaukkarinen
Copy link

Just noticed the same. What's up?

@danparm
Copy link

danparm commented Apr 2, 2021

By setting the failAfterError option to false of gulpStylelint got it working fine. Appears that Stylelint considers any violation as an error. Which then causes the task to fail. I don't agree with that as it prevents the linting of files. My setup generates a JSON file which is then rendered as a report in the browser. Even if Stylelint wants to say that a violation is an error, gulp-stylelint should disregard that. Please let me know what I'm missing here. Is there some config option in Stylelint to prevent a file with violations to be considered "errored?"

chalkygames123 added a commit to chalkygames123/front-end-template that referenced this issue Apr 6, 2021
@mattpfeffer
Copy link

Nothing to add other than to say I'm also running into the same issue. My setup is the same as @danparm . Setting failAfterError to false also worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants