Skip to content
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

Proposed Code Guide Changes #3060

Open
outofambit opened this issue Jul 1, 2024 · 0 comments
Open

Proposed Code Guide Changes #3060

outofambit opened this issue Jul 1, 2024 · 0 comments

Comments

@outofambit
Copy link

Hi, here are some thoughts on changes we could make to the code guide to incorporate newer JS features into them. Normally I would open a PR to propose these, but since it is a wiki page, this seemed like the right place to articulate these first.

I read through the code guide and did some perusing through the current set of examples to get a sense of what the general usage and patterns were and would like to propose adding the following to the JavaScript section of the Code Guide:

  • Use let and const instead of var
  • Use for...of instead of for loops that don't rely on an index for their logic
  • Update class syntax to use class fields (as in, replace this.foo; with foo; in class declarations)
  • Use static methods and blocks for shared utilities specific to an example.
  • Standardize on using a global object when creating new functions and classes. A lot of examples do this but some do not and it is not called out in the code guide. (For example, use const aria = aria || {};)
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

No branches or pull requests

1 participant