-
Notifications
You must be signed in to change notification settings - Fork 358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use local index variables for loops #1370
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file: common/script/aria.js
is from the w3c/aria-common repo.
If you'd like to suggest changes for that file, please submit a PR there. However, that file should not have any effect on anything you are doing with APG.
Please revert the changes to this file.
Done: reverted aria.js |
I wonder if we should add |
I think that's OK, and I wonder why that happens. I suppose some contributors use editors that don't apply the EditorConfig. Maybe this should be enforced with a lint check, too? #1380 |
@mcking65 Yes, this is ok to merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's one more place where the changes re-declare a variable. With that fixed, this looks good to me.
Multiple Examples Code Quality: Use local index variables for loops (pull #1370)
Here’s my story:
I took tabs.js file from the tabs implementation and it worked just fine… Until I transpiled it with babel/preset-env and minified with terser. This is a typical thing to do with any modern JS code.
Babel adds
"use strict";
by default and this is what broke it for me. Turns out there are for loops using global index variables:Which works fine until you add
"use strict";
.I went through all the sample JS code and added
var
in front of every index variable (not defined previously) to make it compatible with the strict mode.Also there are some trailing spaces are gone according to your EditorConfig, sorry about that. I could probably revert that and keep only
var
in this PR.