From c9fbb7f7e2dad26f2483c37849e825f1ff3837e6 Mon Sep 17 00:00:00 2001
From: Dominik George <dominik.george@teckids.org>
Date: Mon, 18 Jul 2022 13:06:13 +0200
Subject: [PATCH] [Dev] Add ESLint and Stylelint

---
 .eslintrc.js      |  9 +++++++++
 .stylelintrc.json |  3 +++
 package.json      |  8 +++++++-
 webpack.config.js | 12 ++++++++++--
 4 files changed, 29 insertions(+), 3 deletions(-)
 create mode 100644 .eslintrc.js
 create mode 100644 .stylelintrc.json

diff --git a/.eslintrc.js b/.eslintrc.js
new file mode 100644
index 000000000..ff2ba5584
--- /dev/null
+++ b/.eslintrc.js
@@ -0,0 +1,9 @@
+module.exports = {
+  extends: [
+    'plugin:vue/strongly-recommended',
+  ],
+  rules: {
+    // override/add rules settings here, such as:
+    // 'vue/no-unused-vars': 'error'
+  }
+}
diff --git a/.stylelintrc.json b/.stylelintrc.json
new file mode 100644
index 000000000..40db42c66
--- /dev/null
+++ b/.stylelintrc.json
@@ -0,0 +1,3 @@
+{
+  "extends": "stylelint-config-standard"
+}
diff --git a/package.json b/package.json
index dc5e529f5..3e3423dc9 100644
--- a/package.json
+++ b/package.json
@@ -1,9 +1,15 @@
 {
   "devDependencies": {
     "css-loader": "^6.7.1",
-    "vue-style-loader": "^4.1.3",
+    "eslint": "^8.20.0",
+    "eslint-plugin-vue": "^9.2.0",
+    "eslint-webpack-plugin": "^3.2.0",
     "sass-loader": "^8.0",
+    "stylelint": "^13.0",
+    "stylelint-config-standard": "^22.0.0",
+    "stylelint-webpack-plugin": "^3.3.0",
     "vue-loader": "^15.0.0",
+    "vue-style-loader": "^4.1.3",
     "vue-template-compiler": "^2.7.7",
     "webpack": "^5.73.0",
     "webpack-bundle-tracker": "^1.6.0",
diff --git a/webpack.config.js b/webpack.config.js
index 7c690833f..b15388b8b 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -1,7 +1,9 @@
 const path = require('path');
 const webpack = require('webpack');
-const BundleTracker = require('webpack-bundle-tracker')
-const { VueLoaderPlugin } = require('vue-loader')
+const BundleTracker = require('webpack-bundle-tracker');
+const { VueLoaderPlugin } = require('vue-loader');
+const ESLintPlugin = require('eslint-webpack-plugin');
+const StyleLintPlugin = require('stylelint-webpack-plugin');
 
 module.exports = {
   context: __dirname,
@@ -19,6 +21,12 @@ module.exports = {
   plugins: [
     new BundleTracker({filename: './webpack-stats.json'}),
     new VueLoaderPlugin(),
+    new ESLintPlugin({
+      extensions: ["js", "vue"],
+    }),
+    new StyleLintPlugin({
+      files: ['assets/**/*.{vue,htm,html,css,sss,less,scss,sass}'],
+    }),
   ],
   module: {
     rules: [
-- 
GitLab