Skip to content

chore: replace var with const/let across codebase#5717

Merged
walterbender merged 2 commits intosugarlabs:masterfrom
vyagh:chore/var-to-const-let
Feb 20, 2026
Merged

chore: replace var with const/let across codebase#5717
walterbender merged 2 commits intosugarlabs:masterfrom
vyagh:chore/var-to-const-let

Conversation

@vyagh
Copy link
Contributor

@vyagh vyagh commented Feb 13, 2026

Description

Converts the remaining var declarations to const or let across the codebase. Most of these are in files that have already been partially modernized, these are just the stragglers that were missed in earlier passes.

Each conversion was checked individually:

  • const for variables that are never reassigned
  • let for variables that are reassigned
  • One unused var that = this removed entirely (in legobricks.js, all the callbacks in that scope already use arrow functions)

Testing Performed

  • Loaded the app locally and verified the full workspace renders with toolbar, palette, and blocks
  • Clicked the Play button, music played correctly, STATUS widget showed active notes
  • Resized the window to 800x600, handled correctly with "Play only mode" message
  • No console errors

Checklist

  • I have tested these changes locally and they work as expected.
  • I have followed the project's coding style guidelines.

Additional Notes for Reviewers

All conversions are mechanical , no logic changes.
The DictActions.js case is worth noting: the two var msg declarations were in separate if/else branches so they didn't conflict, but const is still correct since each branch has its own block scope.

The legobricks.js removal is safe, that was never used anywhere in that scope. All the callbacks already use arrow functions, so this is "lexically bound".

@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

@vyagh vyagh force-pushed the chore/var-to-const-let branch from 9eec786 to 491cd8b Compare February 13, 2026 18:54
@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

Convert remaining var declarations to const/let for block scoping
and clarity. 17 instances across 10 files. No behavioral changes.
@vyagh vyagh force-pushed the chore/var-to-const-let branch from 491cd8b to 689d46d Compare February 14, 2026 05:58
@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

@vanshika2720
Copy link
Contributor

@vyagh @walterbender I’ve reviewed the changes. All var → const/let conversions look correct, and I don’t see any hoisting or scoping issues introduced.

@vyagh
Copy link
Contributor Author

vyagh commented Feb 16, 2026

yupp, did a proper browser testing before the push.
thanks for the validation.

@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

@walterbender walterbender merged commit a234436 into sugarlabs:master Feb 20, 2026
7 checks passed
hassan09070 pushed a commit to hassan09070/musicblocks that referenced this pull request Mar 15, 2026
Convert remaining var declarations to const/let for block scoping
and clarity. 17 instances across 10 files. No behavioral changes.

Co-authored-by: Walter Bender <walter@sugarlabs.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants