| Summary: | Remove ES6 warnings from JavaScript system preferences | ||
|---|---|---|---|
| Product: | Koha | Reporter: | Lucas Gass (lukeg) <lucas> |
| Component: | Architecture, internals, and plumbing | Assignee: | Lucas Gass (lukeg) <lucas> |
| Status: | CLOSED FIXED | QA Contact: | Testopia <testopia> |
| Severity: | minor | ||
| Priority: | P5 - low | CC: | david, dcook, fridolin.somers, julian.maurice |
| Version: | Main | ||
| Hardware: | All | ||
| OS: | All | ||
| GIT URL: | Initiative type: | --- | |
| Sponsorship status: | --- | Comma delimited list of Sponsors: | |
| Crowdfunding goal: | 0 | Patch complexity: | --- |
| Documentation contact: | Documentation submission: | ||
| Text to go in the release notes: |
This removes some warnings when entering JavaScript in UserJS system preferences and library specific OPAC JS, when using ECMAScript 6 features/syntax.
|
Version(s) released in: |
24.05.00,23.11.04
|
| Circulation function: | |||
| Attachments: |
Bug 35718: Remove ES6 warns from JS system preferences
Bug 35718: Remove ES6 warns from JS system preferences Bug 35718: Remove ES6 warnings branches.tt Bug 35718: Remove ES6 warns from JS system preferences Bug 35718: Remove ES6 warnings branches.tt |
||
Created attachment 160584 [details] [review] 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. Created attachment 160613 [details] [review] 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> If no one else gets this first, I'll try to look at it tomorrow or week after next... I know that the bug is only about the system preferences page, but Koha also allows to write JS in the "edit library" page. I think Koha should be consistent about linter settings everywhere it's used. Can you please remove ES6 warnings on the library page too ? Created attachment 162623 [details] [review] Bug 35718: Remove ES6 warnings branches.tt Created attachment 162631 [details] [review] 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> Created attachment 162632 [details] [review] Bug 35718: Remove ES6 warnings branches.tt Signed-off-by: Julian Maurice <julian.maurice@biblibre.com> Thanks for the follow-up. Pushed for 24.05! Well done everyone, thank you! Pushed to 23.11.x for 23.11.04 |
When using any of the UserJS system preferences there are warnings if you use any ES6 features/syntax. To recreate: 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 ES6 syntax is pretty commonly used now, I don't think we need those warnings.