Bugzilla – Attachment 162631 Details for
Bug 35718
Remove ES6 warnings from JavaScript system preferences
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35718: Remove ES6 warns from JS system preferences
Bug-35718-Remove-ES6-warns-from-JS-system-preferen.patch (text/plain), 2.11 KB, created by
Julian Maurice
on 2024-03-01 07:57:02 UTC
(
hide
)
Description:
Bug 35718: Remove ES6 warns from JS system preferences
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2024-03-01 07:57:02 UTC
Size:
2.11 KB
patch
obsolete
>From 9a96bc8d48cdc410bbe94f2b6af740d0e6a300a7 Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Fri, 5 Jan 2024 19:05:01 +0000 >Subject: [PATCH] Bug 35718: Remove ES6 warns from JS system preferences > >To test: >1. Add some JS like this to any of the UserJS system preferences: > >$(document).ready( function() { > let something = 1; > const another_thing = 2; > > let an_arrow_function = (a, b) => a + b; > console.log( an_arrow_function(something, another_thing) ); >}); > >2. Notice the icons and warnings to the left of the line numbers: > >let is available in ES6 >const is available in ES6 >arrow_function_syntax is available in ES6 > >3. APPLY PATCH >4. Try steps 1 and 2 again, the warnings should be gone. >5. Check that the JavaScript still works, in my example it should console.log 3. > >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Julian Maurice <julian.maurice@biblibre.com> >--- > koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js b/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js >index 7823d49d726..2ac7adefac1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js >@@ -89,6 +89,7 @@ function addExpandHandler() { > $(this).hide(); > var target = $(this).data("target"); > var syntax = $(this).data("syntax"); >+ var lint_type = syntax === 'javascript'? { 'esversion': 6 } : true; > $("#collapse_" + target).show(); > if (syntax) { > var editor = CodeMirror.fromTextArea(document.getElementById("pref_" + target), { >@@ -97,7 +98,7 @@ function addExpandHandler() { > lineWrapping: true, > viewportMargin: Infinity, > gutters: ["CodeMirror-lint-markers"], >- lint: true >+ lint: lint_type, > }); > editor.on("change", function () { > mark_modified.call($("#pref_" + target)[0]); >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 35718
:
160584
|
160613
|
162623
| 162631 |
162632