Add CSS linting through stylelint
Include CSS linting by default for our CSS/SCSS files, originally introduced in cockpit. The stylelint configuration is copied from 760a4628282e02fbcef3.
This commit is contained in:
parent
0e2591ee93
commit
ee366ca531
4 changed files with 78 additions and 2 deletions
|
|
@ -9,6 +9,7 @@ const CompressionPlugin = require("compression-webpack-plugin");
|
|||
const ESLintPlugin = require('eslint-webpack-plugin');
|
||||
const CockpitPoPlugin = require("./pkg/lib/cockpit-po-plugin");
|
||||
const CockpitRsyncPlugin = require("./pkg/lib/cockpit-rsync-plugin");
|
||||
const StylelintPlugin = require('stylelint-webpack-plugin');
|
||||
|
||||
/* A standard nodejs and webpack pattern */
|
||||
const production = process.env.NODE_ENV === 'production';
|
||||
|
|
@ -16,6 +17,9 @@ const production = process.env.NODE_ENV === 'production';
|
|||
/* development options for faster iteration */
|
||||
const eslint = process.env.ESLINT !== '0';
|
||||
|
||||
/* Default to disable csslint for faster production builds */
|
||||
const stylelint = process.env.STYLELINT ? (process.env.STYLELINT !== '0') : !production;
|
||||
|
||||
// Obtain package name from package.json
|
||||
const packageJson = JSON.parse(fs.readFileSync('package.json'));
|
||||
|
||||
|
|
@ -36,6 +40,12 @@ if (eslint) {
|
|||
plugins.push(new ESLintPlugin({ extensions: ["js", "jsx"], failOnWarning: true, }));
|
||||
}
|
||||
|
||||
if (stylelint) {
|
||||
plugins.push(new StylelintPlugin({
|
||||
context: "src/",
|
||||
}));
|
||||
}
|
||||
|
||||
/* Only minimize when in production mode */
|
||||
if (production) {
|
||||
plugins.unshift(new CompressionPlugin({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue