Refactor var to const/let in core JS utilities (1/4)#3300
Merged
Mips2648 merged 2 commits intojeedom:developfrom May 5, 2026
Merged
Refactor var to const/let in core JS utilities (1/4)#3300Mips2648 merged 2 commits intojeedom:developfrom
Mips2648 merged 2 commits intojeedom:developfrom
Conversation
Migration of `var` declarations to `const`/`let` in 11 utility/AJAX boilerplate files: jeedom, private, core, cache, queue, listener, network, security, message, dataStore, repo. Also includes incidental fixes that surfaced during the migration: - jeedom.class.js: removed `var Highcharts` declaration that was shadowing window.Highcharts (set by highstock.js loaded later); jeedom.init() crashed with "Highcharts is undefined" without it. - private.class.js: renamed top-level `var init` to `_init` to avoid "redeclaration of non-configurable global property init" (collides with the global function init() in core.js). - private.class.js: changed `const value` to `let value` (it was reassigned by `value += ''`).
3 tasks
kwizer15
suggested changes
May 1, 2026
| jeedom.changes = function() { | ||
| var paramsRequired = [] | ||
| var paramsSpecifics = { | ||
| const paramsRequired =[] |
Contributor
There was a problem hiding this comment.
I noticed the space after = got stripped on empty initializations: const paramsRequired =[] instead of const paramsRequired = []. It's inconsistent with the other assignments in the diff (const params = domUtils.extend(...) keeps the space) and breaks space-infix-ops.
Contributor
Author
|
Good catch @kwizer15, thanks. Fixed in 148493b — restored the space after |
4 tasks
kwizer15
approved these changes
May 2, 2026
Mips2648
approved these changes
May 5, 2026
Salvialf
approved these changes
May 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First of four migration PRs splitting the
var→const/letwork from #3297 by functional domain. This batch covers 11 utility/AJAX-boilerplate files:Most of these files follow the same uniform AJAX boilerplate pattern (
paramsRequired,paramsSpecifics, try/catch,domUtils.ajax(paramsAJAX)), so the migration is largely mechanical:var X = ...→const X = ...for declarations that are never reassigned,letfor the rest.Incidental fixes (caught during migration)
jeedom.class.js— removed the top-levelvar Highchartsdeclaration. Withvarat top-level it becamewindow.Highchartsand was overwritten byhighstock.jsloaded later. Withconst/letit would shadowwindow.Highcharts, leaving the local bindingundefinedand crashingjeedom.init()withTypeError: Highcharts.setOptions is undefined. Fix: rely onwindow.Highchartsdirectly.private.class.js— renamed top-levelvar initto_init. Withconst initit collided with the globalfunction init()declared incore.js(SyntaxError: redeclaration of non-configurable global property init).private.class.js—const value→let value(was reassigned byvalue += '', would have thrownTypeError: Assignment to constant variable).private.class.js— removed unusedvar param = null(dead code).Test plan
jeedom.init()runs without console errorsjeedom.private.getParamsAJAX— verify the result handler still worksinit()and_init()both work where usedPart of the split following #3297 discussion. Stacks logically with #3299 (ESLint baseline) but does not depend on it.