Coder Social home page Coder Social logo

Comments (10)

juanfran avatar juanfran commented on September 26, 2024

Thanks for your feedback!

How do you run the gulpfile to get the exit code?

I've tried this and I get 1

var spawn = require('child_process').spawn,
    lint    = spawn('gulp', ['lint']);

lint.on('close', function (code) {
  console.log('child process exited with code ' + code);
});

from gulp-scss-lint.

Hufschmidt avatar Hufschmidt commented on September 26, 2024

Hi juanfran,

File: hooks/before_prepare/010_gulp-scss-lint.js

#!/usr/bin/env node

var lint  = require('gulp-scss-lint');
var gulp  = require('gulp');

gulp.task('lint', function() {
  return gulp.src('./src/scss/**/*.scss')
    .pipe(lint())
    .pipe(lint.failReporter());
});

gulp.start('lint');

Shell-Command

> nodejs hooks/before_prepare/010_gulp-scss-lint.js

It reports the error in my scss-file, then I check the exit-code that gets passed to the shell via

> echo $? 

which is 0, even on error. This procedure does work with gulp-css-lint, eg. this is the script for css linting:

#!/usr/bin/env node

var lint = require('gulp-jshint');
var gulp = require('gulp');

gulp.task('lint', function() {
  return gulp.src('./src/js/**/*.js')
    .pipe(lint())
    .pipe(lint.reporter('jshint-stylish'))
    .pipe(lint.reporter('fail'));
});

gulp.start('lint');

from gulp-scss-lint.

Hufschmidt avatar Hufschmidt commented on September 26, 2024

I did some more investigation on running gulp directly, with

> gulp --gulpfile hooks/before_prepare/010_gulp-scss-lint.js lint

I do get the correct exit-code (1 on error/warning) on the shell, once I make gulp.src(...) relative to the gulpfile.

This does seem strange though, since I can invoke all other linters (gulp-csslint, gulp-htmlhint, gulp-jshint) using gulp as node module.

from gulp-scss-lint.

juanfran avatar juanfran commented on September 26, 2024

I think that I've found the problem but It's very strange and I don't know exactly why... sorry but maybe It will take me some days

from gulp-scss-lint.

Hufschmidt avatar Hufschmidt commented on September 26, 2024

Thanks for taking the time. :bowtie:

from gulp-scss-lint.

juanfran avatar juanfran commented on September 26, 2024

sorry for the delay, could you try with the 0.3.8 version? thanks

from gulp-scss-lint.

Hufschmidt avatar Hufschmidt commented on September 26, 2024

Updated to version 0.3.8, but still the same, I'll add the full output maybe this helps:

$ node hooks/before_prepare/010_gulp-scss-lint.js 
[08:34:55] 1 issues found in /home/hufschmt/Workspace/WebView/mILIAS/src/scss/ionic.app.scss
[08:34:55] ionic.app.scss:43 [E] Syntax Error: Invalid CSS after "...nic/scss/ionic'": expected "{", was ";"
Unhandled rejection Error in plugin 'gulp-scss-lint'
Message:
    ScssLint failed for: ionic.app.scss

$ echo $?
0

and

$ gulp --gulpfile hooks/before_prepare/010_gulp-scss-lint.js lint
[08:39:46] Working directory changed to ~/Workspace/WebView/mILIAS/hooks/before_prepare
[08:39:46] Using gulpfile ~/Workspace/WebView/mILIAS/hooks/before_prepare/010_gulp-scss-lint.js
[08:39:46] Starting 'lint'...
[08:39:47] 1 issues found in /home/hufschmt/Workspace/WebView/mILIAS/src/scss/ionic.app.scss
[08:39:47] ionic.app.scss:43 [E] Syntax Error: Invalid CSS after "...nic/scss/ionic'": expected "{", was ";"
[08:39:47] 'lint' errored after 266 ms
[08:39:47] Error in plugin 'gulp-scss-lint'
Message:
    ScssLint failed for: ionic.app.scss

$ echo $?
1

from gulp-scss-lint.

juanfran avatar juanfran commented on September 26, 2024

I've test this issue with this https://github.com/juanfran/gulp-scss-lint-test-error before the 0.3.8 I had the wrong exit code, but now works well for me, could you try with this repo and tell me what is different?

thank you!

from gulp-scss-lint.

Hufschmidt avatar Hufschmidt commented on September 26, 2024

TL;DR: I tested your example and it works, my issue is resolved. 😄

Details:
Extracting your example to a random folder worked both via calling gulp and as node module.

I tried figuring out why this didn't seem to work with my code and copied piece by piece of your example into my working directory, which caused even your example to fail (again).

After this it was clear that something in my working dir was wrong, so I removed all node_modules and reinstalled them with npm install, which low and behold fixed your example (copied into my project folder) and my project...

So my guess is, although I did update via npm install gulp-scss-lint and even checked version under node_modules/gulp-scss-lint/packages.json, something must have gone wrong, the problem is fixed in 0.3.8.

I'll leave the pleasure of closing this issue to you. 😄

from gulp-scss-lint.

juanfran avatar juanfran commented on September 26, 2024

😄 thanks!

from gulp-scss-lint.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.