From a1873452fd5b189a13746b94d2d3d555dca65b99 Mon Sep 17 00:00:00 2001 From: silverwind Date: Fri, 6 Nov 2020 19:00:59 +0100 Subject: [PATCH 1/7] Add Vue linting Turns out the .vue files were not linted at all, so I added that as well as re-indented the file to 2-space and fixed all reasonable issues that cam up except one case of a unintended side effect for which I have no idea how to fix it, so the rule was disabled. --- .eslintrc | 9 + Makefile | 2 +- package.json | 1 + web_src/js/components/ActivityHeatmap.vue | 126 +++++++------ web_src/js/components/ActivityTopAuthors.vue | 184 ++++++++++--------- web_src/js/index.js | 94 +++++----- 6 files changed, 217 insertions(+), 199 deletions(-) diff --git a/.eslintrc b/.eslintrc index 7b8376e8ea595..8ea5a26c600d2 100644 --- a/.eslintrc +++ b/.eslintrc @@ -11,6 +11,10 @@ parserOptions: plugins: - eslint-plugin-unicorn - eslint-plugin-import + - eslint-plugin-vue + +extends: + - plugin:vue/recommended env: es2021: true @@ -387,6 +391,11 @@ rules: use-isnan: [2] valid-typeof: [2, {requireStringLiterals: true}] vars-on-top: [0] + vue/attributes-order: [0] + vue/component-definition-name-casing: [0] + vue/html-closing-bracket-spacing: [0] + vue/max-attributes-per-line: [0] + vue/one-component-per-file: [0] wrap-iife: [2, inside] wrap-regex: [0] yield-star-spacing: [2, after] diff --git a/Makefile b/Makefile index 301a38f50730d..4b6b9de25f691 100644 --- a/Makefile +++ b/Makefile @@ -312,7 +312,7 @@ lint: lint-frontend lint-backend .PHONY: lint-frontend lint-frontend: node_modules - npx eslint web_src/js build webpack.config.js + npx eslint --ext .js,.vue web_src/js build webpack.config.js npx stylelint web_src/less .PHONY: lint-backend diff --git a/package.json b/package.json index 4d0a055297115..3c6013daf6579 100644 --- a/package.json +++ b/package.json @@ -54,6 +54,7 @@ "eslint": "7.11.0", "eslint-plugin-import": "2.22.1", "eslint-plugin-unicorn": "23.0.0", + "eslint-plugin-vue": "7.1.0", "stylelint": "13.7.2", "stylelint-config-standard": "20.0.0", "svgo": "1.3.2", diff --git a/web_src/js/components/ActivityHeatmap.vue b/web_src/js/components/ActivityHeatmap.vue index ec241b64fae8c..d65b4d3817f1e 100644 --- a/web_src/js/components/ActivityHeatmap.vue +++ b/web_src/js/components/ActivityHeatmap.vue @@ -1,13 +1,21 @@ +