Code Monkey home page Code Monkey logo

Comments (5)

orionrush avatar orionrush commented on June 7, 2024 1

Just to see if running stylelint as a postcss plugin would produce similar results, I found that the .stylelintignore is not honoured at all. Possibly related to this. That issue was closed, by postcss as the recommendation was to use stylelint as a stand-alone tool, or with gulp-stylelint–– namecheck!

For anyone that is curious, here is what I tried:

const { src, dest, task, watch, series, parallel } = require("gulp");
const 
    stylelint = require("stylelint"),
    reporter = require("postcss-reporter"),
    postcssSass = require("postcss-sass");

var stylePrefs = {
    syntax: require("postcss-scss"),
    processor: [stylelint({ fix: true, ignoreFiles: ["/styles/scss/vendor/"] }), reporter({ clearReportedMessages: true })],
}

function lint_styles(done) {
    src("./styles/**/*")
        .pipe(plumber())
        .pipe(
            postcss(stylePrefs.processor, {
                syntax: stylePrefs.syntax,
            })
        )
        .pipe(dest("./styles/"));
    done();
}

task("lintStyles", lint_styles);

Just to be through(hopefull) I also tried different combinations of the ignoreFiles: ["./styles/scss/vendor/"] flag to no avail.

One nice bonus of using gulp-stylelint is that the console error formatting is much nicer! so I hope we can find a way through this.

from gulp-stylelint.

mattcasey avatar mattcasey commented on June 7, 2024 1

I solved it for now using a custom formatter. You can also filter out warnings this way:

const stylelint = require('stylelint');

gulp.src( sourcePath('styles.scss') )
  .pipe(gulpStylelint({
      reporters: [
        {
          console: true,
          // https://github.com/stylelint/stylelint/blob/master/docs/developer-guide/formatters.md
          formatter: function (results) {
            const filtered = results.filter(r => {
              // ignore bootstrap src
              if (/bootstrap/.test(r.source)) {
                return false;
              }
              r.warnings = r.warnings.filter(w => w.severity === 'error');
              return r.warnings.length > 0;
            });
            return stylelint.formatters.string(filtered);
          }
        }
      ]
    })

from gulp-stylelint.

markleppke avatar markleppke commented on June 7, 2024

I tried using the custom formatter above. No luck in our environment. Simply doesn't work. Any news on gulp-stylelint getting future updates? Seems like gulp and it's ecosystem is dying... Do i need to switch to webpack?

from gulp-stylelint.

ajiho avatar ajiho commented on June 7, 2024
gulp.task('fix-css', function () {
    
    return gulp
        .src([
            'src/scss/**/*.scss',
            //Exclude the same directory as in the `.stylelintignore` file
            '!src/scss/plugins-override/*.scss',
        ])
        .pipe(gulpStylelint({
            fix: true,
        }))
        .pipe(gulp.dest('src/scss'));

});

from gulp-stylelint.

ronilaukkarinen avatar ronilaukkarinen commented on June 7, 2024

I tried using the custom formatter above. No luck in our environment. Simply doesn't work. Any news on gulp-stylelint getting future updates? Seems like gulp and it's ecosystem is dying... Do i need to switch to webpack?

This repository is abandoned. Use my fork, see the comment here.

from gulp-stylelint.

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.