GithubHelp home page GithubHelp logo

isabella232 / sasslint-loader Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alleyinteractive/sasslint-loader

0.0 0.0 0.0 26 KB

sass lint loader for webpack

License: MIT License

JavaScript 86.84% CSS 13.16%

sasslint-loader's Introduction

Note This loader is no longer under development, we have switched from a loader to a plugin, please use: Sasslint Webpack Plugin

sasslint-loader

sasslint loader for webpack

Install

$ npm install sasslint-loader

Usage

In your webpack configuration

module.exports = {
  // ...
  module: {
    loaders: {
      {
        test: /\s[a|c]ss$/,
        exclude: /node_modules/,
        loader: 'sasslint'
      }
    }
  }
  // ...
}

To avoid issues with processing order, it's preferrable to use the preLoaders module property, so your files get linted before any other loaders are applied.

module.exports = {
  // ...
  module: {
    preLoaders: {
      {
        test: /\s[a|c]ss$/,
        exclude: /node_modules/,
        loader: 'sasslint'
      }
    }
  }
  // ...
}

Options

You can pass a sasslint options yml file directly by adding a sasslint entry in your webpack config for global options:

module.exports = {
  sasslint: {
    configFile: 'path/.sass-lint.yml'
  }
}

Errors and Warnings

By default the loader will auto adjust error reporting depending on sasslint error/warning counts. You can still force this behavior by using emitError or emitWarning options:

emitError (default: false)

Loader will always return errors if this option is set to true.

module.exports = {
  entry: '...',
  module: {
    // ...
  },
  sasslint: {
    emitError: true
  }
}
emitWarning (default: false)

Loader will always return warnings if this option is set to true.

quiet (default: false)

Loader will process and report errors only and ignore warnings if this option is set to true.

module.exports = {
  entry: '...',
  module: {
    // ...
  },
  sasslint: {
    quiet: true
  }
}
failOnWarning (default: false)

Loader will cause the module build to fail if there are any sasslint warnings.

module.exports = {
  entry: '...',
  module: {
    // ...
  },
  sasslint: {
    failOnWarning: true
  }
}
failOnError (default: false)

Loader will cause the module build to fail if there are any sasslint errors.

module.exports = {
  entry: '...',
  module: {
    // ...
  },
  sasslint: {
    failOnError: true
  }
}

Gotchas

ExtractTextPlugin

ExtractTextPlugin will run the loaders a second time, and you will see duplicate logs. To disable this behavior, hide stats for child plugins.

module.exports = {
  entry: '...',
  module: {
    // ...
  },
  stats: {
    children: false
  }
}

NoErrorsPlugin

NoErrorsPlugin prevents Webpack from outputting anything into a bundle. So even sass-lint warnings will fail the build. No matter what error settings are used for sasslint-loader.

So if you want to see sass-lint warnings in console during development using WebpackDevServer remove NoErrorsPlugin from webpack config.

License

sasslint-loader's People

Contributors

dmachat avatar jackmarketon avatar

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.