From 228eaee64fa7aa5b82e2d0a7c639d2d2c1f1aefb Mon Sep 17 00:00:00 2001 From: silverwind Date: Mon, 11 Jul 2022 23:18:49 +0200 Subject: [PATCH 1/3] Fix eslint parsing errors Introduce a separate .eslintrc in the Vue components folder to selectively enable vue-eslint-parser there, so that the rest of the files can use eslint's core parser which can deal with hashbangs. The fact that the eslint-disable comments worked in HTML was a unintended side-effect of the files being parsed via vue-eslint-parser, so I had to disable the parsing of these files in .eslintrc.yaml to make it work. --- .eslintrc.yaml | 13 +++---------- Makefile | 2 +- templates/base/head_script.tmpl | 1 - templates/repo/issue/view_content/pull.tmpl | 1 - web_src/js/components/.eslintrc.yaml | 16 ++++++++++++++++ 5 files changed, 20 insertions(+), 13 deletions(-) create mode 100644 web_src/js/components/.eslintrc.yaml diff --git a/.eslintrc.yaml b/.eslintrc.yaml index ff62d9cc93b00..fbc23215cf2a0 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -3,6 +3,8 @@ reportUnusedDisableDirectives: true ignorePatterns: - /web_src/js/vendor + - /templates/base/head_script.tmpl + - /templates/repo/issue/view_content/pull.tmpl parserOptions: sourceType: module @@ -11,13 +13,9 @@ parserOptions: plugins: - eslint-plugin-unicorn - eslint-plugin-import - - eslint-plugin-vue - eslint-plugin-html - eslint-plugin-jquery -extends: - - plugin:vue/recommended - env: es2022: true node: true @@ -29,7 +27,7 @@ settings: html/html-extensions: [".tmpl"] overrides: - - files: ["web_src/**/*.js", "web_src/**/*.vue", "templates/**/*.tmpl"] + - files: ["web_src/**/*.js", "templates/**/*.tmpl", "docs/**/*.js"] env: browser: true node: false @@ -502,11 +500,6 @@ 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 5536788613c4f..69cab6daeb918 100644 --- a/Makefile +++ b/Makefile @@ -310,7 +310,7 @@ lint: lint-frontend lint-backend .PHONY: lint-frontend lint-frontend: node_modules - npx eslint --color --max-warnings=0 web_src/js build templates *.config.js docs/assets/js + npx eslint --color --max-warnings=0 --ext js,vue,tmpl web_src/js build templates *.config.js docs/assets/js npx stylelint --color --max-warnings=0 web_src/less npx spectral lint -q -F hint $(SWAGGER_SPEC) diff --git a/templates/base/head_script.tmpl b/templates/base/head_script.tmpl index 2f74b959e2a1a..48a3df693a39b 100644 --- a/templates/base/head_script.tmpl +++ b/templates/base/head_script.tmpl @@ -4,7 +4,6 @@ If you are customizing Gitea, please do not change this file. If you introduce mistakes in it, Gitea JavaScript code wouldn't run correctly. */}}