From 37204c57e5a50d985aeb82278e60b41a73770c9e Mon Sep 17 00:00:00 2001 From: rtak Date: Tue, 23 Jun 2020 15:17:42 +0200 Subject: [PATCH] Added eslint and stylelint to webpack building --- app/templates/package.json | 2 ++ app/templates/webpack.config.js | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/app/templates/package.json b/app/templates/package.json index 0b08e22..6719196 100755 --- a/app/templates/package.json +++ b/app/templates/package.json @@ -27,6 +27,7 @@ "eslint-config-airbnb": "^17.1.0", "eslint-config-prettier": "^4.2.0", "eslint-config-wesbos": "0.0.19", + "eslint-loader": "^4.0.2", "eslint-plugin-html": "^5.0.3", "eslint-plugin-import": "^2.17.2", "eslint-plugin-jsx-a11y": "^6.2.1", @@ -43,6 +44,7 @@ "stylelint": "^10.0.1", "stylelint-config-supple": "^2.1.0", "stylelint-scss": "^3.6.1", + "stylelint-webpack-plugin": "^2.1.0", "svg-sprite-loader": "^4.1.6", "svg-spritemap-webpack-plugin": "^3.3.0", "svgo-loader": "^2.2.0", diff --git a/app/templates/webpack.config.js b/app/templates/webpack.config.js index 326cb2d..040dd9a 100755 --- a/app/templates/webpack.config.js +++ b/app/templates/webpack.config.js @@ -7,6 +7,7 @@ const CleanWebpackPlugin = require('clean-webpack-plugin'); const CopyPlugin = require('copy-webpack-plugin'); const WebpackNotifierPlugin = require('webpack-notifier'); const SVGSpritemapPlugin = require('svg-spritemap-webpack-plugin'); +const StylelintPlugin = require('stylelint-webpack-plugin'); // Get gonfig const { @@ -33,6 +34,12 @@ module.exports = { module: { rules: [ // javascript + { + enforce: 'pre', + test: /\.js$/, + exclude: /node_modules/, + loader: 'eslint-loader', + }, { test: /\.m?js$/, exclude: /(node_modules|bower_components)/, @@ -130,6 +137,12 @@ module.exports = { }, ]), + // Style lint + new StylelintPlugin({ + configFile: '.stylelintrc', + files: `${paths.source}/**/*.scss`, + }), + new WebpackNotifierPlugin({ title: 'Webpack', excludeWarnings: true,