mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-31 20:02:09 +00:00
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>
This commit is contained in:
parent
3f13e07849
commit
7ab3633598
7 changed files with 81 additions and 9 deletions
|
@ -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());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue