standard-loader

raw JSON →
7.0.0 verified Sat Apr 25 auth: no javascript

A webpack loader that lints JavaScript code using JavaScript Standard Style (standard). Version 7.0.0 is current, with maintenance as needed. It integrates with webpack 2+ (webpack 1 dropped in v6). Key differentiators: leverages the popular 'standard' style guide, supports custom parsers like babel-eslint, emits detailed warnings/errors with snazzy output, and follows the conventional module format for webpack loaders.

error Error: Cannot find module 'standard'
cause Missing peer dependency 'standard'.
fix
npm install --save-dev standard
error Module build failed: Error: No matching loader for 'standard-loader'
cause Loader not configured in webpack rules.
fix
Add standard-loader to module.rules with enforce: 'pre'.
error WARNING: Failed to load parser 'babel-eslint'
cause Parser not installed.
fix
npm install --save-dev babel-eslint
breaking webpack 1 support dropped in version 6.0.0. Use 5.x branch for webpack 1.
fix Upgrade to webpack 2+ or use standard-loader@5.x.
deprecated Option 'emitErrors' is deprecated; use 'error' instead.
fix Replace 'emitErrors: true' with 'error: true'.
gotcha Loader must be placed in 'rules' array, not 'loaders'.
fix Use module.rules, not module.loaders.
gotcha standard must be installed as a peer dependency; not included automatically.
fix Run 'npm install --save-dev standard-loader standard'.
npm install standard-loader
yarn add standard-loader
pnpm add standard-loader

Configure standard-loader as a webpack preloader to lint .js and .jsx files using Standard style with optional parser.

// webpack.config.js
module.exports = {
  module: {
    rules: [
      {
        enforce: 'pre',
        test: /\.jsx?$/,
        loader: 'standard-loader',
        exclude: /node_modules/,
        options: {
          parser: 'babel-eslint',
          snazzy: true
        }
      }
    ]
  }
};