diff options
author | silverwind <me@silverwind.io> | 2020-11-28 00:01:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-28 01:01:33 +0200 |
commit | 7ab363359815fa1cf67a217b0a03e7ecf24fb4fe (patch) | |
tree | 6c162ca9f11765b64efecf714a66d49a59f892bc /templates/repo | |
parent | 3f13e078491753827e5e44f7133d3f58113f6fb4 (diff) | |
download | gitea-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 'templates/repo')
-rw-r--r-- | templates/repo/diff/box.tmpl | 10 | ||||
-rw-r--r-- | templates/repo/home.tmpl | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index d34d9b8fd9..d278e94457 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -278,14 +278,14 @@ {{if .IsSplitStyle}} <script> - document.addEventListener('DOMContentLoaded', function() { + document.addEventListener('DOMContentLoaded', () => { $('tr.add-code').each(function() { - var prev = $(this).prev(); - if(prev.is('.del-code') && prev.children().eq(5).text().trim() === '') { - while(prev.prev().is('.del-code') && prev.prev().children().eq(5).text().trim() === '') { + let prev = $(this).prev(); + if (prev.is('.del-code') && prev.children().eq(5).text().trim() === '') { + while (prev.prev().is('.del-code') && prev.prev().children().eq(5).text().trim() === '') { prev = prev.prev(); } - prev.children().eq(3).attr("data-line-num", $(this).children().eq(3).attr("data-line-num")); + prev.children().eq(3).attr('data-line-num', $(this).children().eq(3).attr('data-line-num')); prev.children().eq(3).html($(this).children().eq(3).html()); prev.children().eq(4).html($(this).children().eq(4).html()); prev.children().eq(5).html($(this).children().eq(5).html()); diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index ee3406fac6..73508bdd2f 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -135,7 +135,7 @@ if (httpsButton) httpsButton.classList[isSSH ? 'remove' : 'add']('primary'); setTimeout(() => { if (sshButton) sshButton.classList.remove('no-transition'); - if (httpsButto) httpsButton.classList.remove('no-transition'); + if (httpsButton) httpsButton.classList.remove('no-transition'); }, 100); </script> {{if or (not $.DisableHTTP) (and (not $.DisableSSH) (or $.IsSigned $.ExposeAnonSSH))}} |