A webpack plugin to run custom lint shell command
lint-webpack-plugin is a simple script to run custom lint commands.
If it's build (webpack
), it will run the commands before the webpack build
starts. If there is any error occuring in the commands, the webpack process will
stop.
If it's watch (webpack --watch
), it will run the commands with the webpack
build. Although there is any error, it will be ignored and the webpack process
will continue to work.
npm i --save-dev lint-webpack-plugin
An example webpack.config.js
with TypeScript and Prettier:
const LintPlugin = require('lint-webpack-plugin');
module.exports = {
...
plugins: [
new LintPlugin([
'tsc --noEmit',
"prettier -l --parser=babylon \'src/**/*'"
])
]
};
Please note that the current ./node_modules/.bin
will be added to PATH
, so
local package binaries can be used directly.
If you want to run shell commands at more specific timings, please use webpack-shell-plugin.