summaryrefslogtreecommitdiffstats
path: root/.eslintrc
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2020-11-28 00:01:33 +0100
committerGitHub <noreply@github.com>2020-11-28 01:01:33 +0200
commit7ab363359815fa1cf67a217b0a03e7ecf24fb4fe (patch)
tree6c162ca9f11765b64efecf714a66d49a59f892bc /.eslintrc
parent3f13e078491753827e5e44f7133d3f58113f6fb4 (diff)
downloadgitea-7ab363359815fa1cf67a217b0a03e7ecf24fb4fe.tar.gz
gitea-7ab363359815fa1cf67a217b0a03e7ecf24fb4fe.zip
Enable linting of JS inside templates (#13708)
Indentation-related rules are disabled because indent templates with tabs but our lint rules expect spaces. Also had to exclude a few files where using template variables in the JS is causing syntax errors for the JS parser. I don't think there's a way to solve this otherwise. Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to '.eslintrc')
-rw-r--r--.eslintrc13
1 files changed, 12 insertions, 1 deletions
diff --git a/.eslintrc b/.eslintrc
index 398d1a610f..f289e79b91 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -3,6 +3,9 @@ reportUnusedDisableDirectives: true
ignorePatterns:
- /web_src/js/vendor
+ - /templates/base/head.tmpl
+ - /templates/repo/activity.tmpl
+ - /templates/repo/view_file.tmpl
parserOptions:
sourceType: module
@@ -12,6 +15,7 @@ plugins:
- eslint-plugin-unicorn
- eslint-plugin-import
- eslint-plugin-vue
+ - eslint-plugin-html
extends:
- plugin:vue/recommended
@@ -27,12 +31,19 @@ globals:
SimpleMDE: false
u2fApi: false
+settings:
+ html/html-extensions: [".tmpl"]
+
overrides:
- - files: ["web_src/**/*.js", "web_src/**/*.vue"]
+ - files: ["web_src/**/*.js", "web_src/**/*.vue", "templates/**/*.tmpl"]
env:
browser: true
jquery: true
node: false
+ - files: ["templates/**/*.tmpl"]
+ rules:
+ no-tabs: [0]
+ indent: [2, tab, {SwitchCase: 1}]
- files: ["web_src/**/*worker.js"]
env:
worker: true