pandaduc / stylint-loader

(UNMAINTAINED) stylint loader for webpack

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

stylint-loader Build Status

stylint loader for webpack

Install

Install the stylint peerDependency manually (only if you're using npm v3 or earlier)

npm install --save-dev stylint

Install stylint-loader package

// webpack 1
npm install stylint-loader@1.x

// webpack 3+
npm install stylint-loader@latest

Usage

Documentation: Using loaders

When using with stylus-loader, make sure they are in correct order

module.exports = {
  // ...
  module: {
    rules: [
      {
        test: /\.styl$/, 
        loader: 'stylint-loader'
      },
      {
        test: /\.styl$/,
        use: [
          'style-loader',
          'css-loader',
          'stylus-loader'
        ]
      }
    ]
  }
  // ...
}

To be safe, you can use preLoaders section to check source files, not modified by stylus-loader

module.exports = {
  // ...
  module: {
    rules: [
      {
        enforce: 'pre',
        test: /\.styl$/, 
        loader: 'stylint-loader'
      }
    ]
  }
  // ...
}

Options

You can pass stylint options directly by

  • Adding a query string to the loader for this loader usabe only
{
  module: {
    rules: [
      {
        test: /\.js$/,
        loader: 'stylint-loader?{brackets: "never"}',
        exclude: /node_modules/,
      }
    ],
  },
}
  • Adding an stylint entry in your webpack config for global options:
plugins: [
  new webpack.LoaderOptionsPlugin({
    options: {
      stylint: {
        config: 'path/.stylintrc'
      }
    }
  })
]

Note that you can use both method in order to benefit from global & specific options

About

(UNMAINTAINED) stylint loader for webpack

License:MIT License


Languages

Language:JavaScript 100.0%