Install the desired version of standard alongside standard-loader.
npm install --save-dev standard-loader standard
Usage
webpack 2+
// webpack.config.jsconst webpack = require('webpack')const config = { // ... module: { rules: [ { // set up standard-loader as a preloader enforce: 'pre', test: /\.jsx?$/, loader: 'standard-loader', exclude: /(node_modules|bower_components)/, options: { // config options to be passed through to standard e.g. parser: 'babel-eslint' } }, // other loaders... ] }}
{ // Emit errors instead of warnings (default = false) error: false, // enable snazzy output (default = true) snazzy: true, // configure alternative checker e.g. 'standardx' (default = 'standard') standard: 'standard', // all other config options are passed through to standard e.g. parser: 'babel-eslint'}
Example Input
//code not conforming to standard stylemodule.exports = function(a,b) { console.log( a, b);}
Example Output
> webpackHash: c5c5efad42144b469dcdVersion: webpack 4.0.1Time: 974msBuilt at: 2018-3-3 19:54:20 Asset Size Chunks Chunk Namesbuild.js 3.38 KiB bundle [emitted] bundleEntrypoint bundle = build.js[./index.js] 592 bytes {bundle} [built] [1 warning] single entry ./index.js bundleWARNING in ./index.js/Users/timoxley/Projects/standard-loader/example/index.js 1:1 error Expected space or tab after '//' in comment spaced-comment 3:26 error Missing space before function parentheses space-before-function-paren 3:28 error A space is required after ',' comma-spacing 4:1 error Expected indentation of 2 spaces but found 4 indent 4:16 error There should be no spaces inside this paren space-in-parens 4:23 error Extra semicolon semi 6:1 error More than 1 blank line not allowed no-multiple-empty-lines✖ 7 problems