diff options
author | silverwind <me@silverwind.io> | 2020-06-09 23:31:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-09 17:31:15 -0400 |
commit | 19db3f4f0a6739e10aaa36d86ef5fd89dcf71467 (patch) | |
tree | 8c9dd890e7767c3582f981381d1c7697833e29c7 /web_src/js/features | |
parent | 363e51d19c7ae63a12554fbfb4dd4f59e87db339 (diff) | |
download | gitea-19db3f4f0a6739e10aaa36d86ef5fd89dcf71467.tar.gz gitea-19db3f4f0a6739e10aaa36d86ef5fd89dcf71467.zip |
rework eslint config (#11615)
* rework eslint config
- use explicit config that only enables rules
- upgrade eslint to 7.1.0
- add new plugins with selected rules enabled
- fix discovered issues, remove global wipPrefixes
* remove if
* undo template change
* add disabled rules as well for easier config updating
* add missing disabled rule
* update eslint and plugins
* fix new violation
* remove deprecated rules
Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'web_src/js/features')
-rw-r--r-- | web_src/js/features/clipboard.js | 17 | ||||
-rw-r--r-- | web_src/js/features/codeeditor.js | 2 | ||||
-rw-r--r-- | web_src/js/features/highlight.worker.js | 4 |
3 files changed, 11 insertions, 12 deletions
diff --git a/web_src/js/features/clipboard.js b/web_src/js/features/clipboard.js index a3b6b26eb3..32eff981b8 100644 --- a/web_src/js/features/clipboard.js +++ b/web_src/js/features/clipboard.js @@ -7,17 +7,16 @@ export default async function initClipboard() { const clipboard = new ClipboardJS(els); clipboard.on('success', (e) => { e.clearSelection(); - - $(`#${e.trigger.getAttribute('id')}`).popup('destroy'); - e.trigger.setAttribute('data-content', e.trigger.getAttribute('data-success')); - $(`#${e.trigger.getAttribute('id')}`).popup('show'); - e.trigger.setAttribute('data-content', e.trigger.getAttribute('data-original')); + $(e.trigger).popup('destroy'); + e.trigger.dataset.content = e.trigger.dataset.success; + $(e.trigger).popup('show'); + e.trigger.dataset.content = e.trigger.dataset.original; }); clipboard.on('error', (e) => { - $(`#${e.trigger.getAttribute('id')}`).popup('destroy'); - e.trigger.setAttribute('data-content', e.trigger.getAttribute('data-error')); - $(`#${e.trigger.getAttribute('id')}`).popup('show'); - e.trigger.setAttribute('data-content', e.trigger.getAttribute('data-original')); + $(e.trigger).popup('destroy'); + e.trigger.dataset.content = e.trigger.dataset.error; + $(e.trigger).popup('show'); + e.trigger.dataset.content = e.trigger.dataset.original; }); } diff --git a/web_src/js/features/codeeditor.js b/web_src/js/features/codeeditor.js index 2e268379b2..d9ddb58d00 100644 --- a/web_src/js/features/codeeditor.js +++ b/web_src/js/features/codeeditor.js @@ -6,7 +6,7 @@ const languagesByExt = {}; function getEditorconfig(input) { try { return JSON.parse(input.dataset.editorconfig); - } catch (_err) { + } catch { return null; } } diff --git a/web_src/js/features/highlight.worker.js b/web_src/js/features/highlight.worker.js index 7d6cc4e438..4a0f55f441 100644 --- a/web_src/js/features/highlight.worker.js +++ b/web_src/js/features/highlight.worker.js @@ -1,7 +1,7 @@ import {highlightBlock} from 'highlight.js'; import {createWindow} from 'domino'; -self.onmessage = function ({data}) { +self.addEventListener('message', ({data}) => { const window = createWindow(); self.document = window.document; @@ -9,4 +9,4 @@ self.onmessage = function ({data}) { document.body.innerHTML = html; highlightBlock(document.body.firstChild); self.postMessage({index, html: document.body.innerHTML}); -}; +}); |