JS code quality, modernization for core modx and component classes#16967
Open
smg6511 wants to merge 7 commits into
Open
JS code quality, modernization for core modx and component classes#16967smg6511 wants to merge 7 commits into
smg6511 wants to merge 7 commits into
Conversation
Spacing, comma/bracing positioning, etc.
Modernize/organize declarations, spell out some of the abbr names
Modernize concat and loop incrementing, use strict type comparisons, clarify some vars
- status method: Fix mistake in var order and remove IE8 compat condition. - getStatusMarkup method: re-arrange to make more clear/readable
Modernize getURLParameters method, simplifying syntax while adding ability to capture array values
- Convert for / for-in loops to forEach where appropriate (scoping of this, verified); - add method: Improvement of handler inclusion (organization, prioritizing the cases that happen more often toward the top of the conditions tree)
Added clarifying 2 comments
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.
What changed and why
This is a formatting/style/syntax only set of changes to bring these JS classes up to par with coding standards and our linting rules. As with my previous merged update (#16963) a majority of lines changed are due to whitespace and comma placement changes.
I'm doing this ahead of working on a few issue-related PRs that touch these areas.
How to test
Navigate around the manager and view and edit various items; all should work as expected and throw no errors in the console. Requires a
grunt/buildif you are reviewing withcompress_json.Related issue(s)/PR(s)
n/a
Compatibility notes
n/a
Breaking change assessment
None
Test coverage
While we don't have a mechanism to unit test our legacy ext js code, more sensitive changes like converting for-ins to forEach and re-organization/optimization of a couple methods were all manually tested to ensure correct scope and output was maintained.
To examine these changes more easily, take a look at the individual commits.
Contributors
n/a
AI tool use
None