Allow disabling eslint checks for development purposes

Sometimes developers want to quickly check if something work and there
is no need to style to eslint liking.
This commit is contained in:
Matej Marusak 2022-02-21 13:52:37 +01:00 committed by Matej Marusak
parent ea8b606243
commit 052eb5d57a

View file

@ -13,6 +13,9 @@ const CockpitRsyncPlugin = require("./src/lib/cockpit-rsync-plugin");
/* A standard nodejs and webpack pattern */ /* A standard nodejs and webpack pattern */
const production = process.env.NODE_ENV === 'production'; const production = process.env.NODE_ENV === 'production';
/* development options for faster iteration */
const eslint = process.env.ESLINT !== '0';
// Obtain package name from package.json // Obtain package name from package.json
const packageJson = JSON.parse(fs.readFileSync('package.json')); const packageJson = JSON.parse(fs.readFileSync('package.json'));
@ -25,14 +28,14 @@ const copy_files = [
const plugins = [ const plugins = [
new copy({ patterns: copy_files }), new copy({ patterns: copy_files }),
new extract({filename: "[name].css"}), new extract({filename: "[name].css"}),
new ESLintPlugin({
extensions: ["js", "jsx"],
failOnWarning: true,
}),
new CockpitPoPlugin(), new CockpitPoPlugin(),
new CockpitRsyncPlugin({dest: packageJson.name}), new CockpitRsyncPlugin({dest: packageJson.name}),
]; ];
if (eslint) {
plugins.push(new ESLintPlugin({ extensions: ["js", "jsx"], failOnWarning: true, }));
}
/* Only minimize when in production mode */ /* Only minimize when in production mode */
if (production) { if (production) {
plugins.unshift(new CompressionPlugin({ plugins.unshift(new CompressionPlugin({