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

Web Blockly Style Guide needs updating for ES6 #5070

Closed
1 of 3 tasks
cpcallen opened this issue Jul 15, 2021 · 1 comment
Closed
1 of 3 tasks

Web Blockly Style Guide needs updating for ES6 #5070

cpcallen opened this issue Jul 15, 2021 · 1 comment
Assignees
Labels
issue: docs Describes missing or incorrect documentation

Comments

@cpcallen
Copy link
Contributor

cpcallen commented Jul 15, 2021

Where

Web Blockly Style Guide, "Don't" section

What

  • Text
  • Image or Gif
  • Other

Old content

TL;DR

Follow the Google JavaScript style guide. If you are not sure which style to use, follow the style of the existing code. If the style guide says to use a feature that does not exist in Internet Explorer 10, ignore it.

Do

  • Redeclare variables in for loops. That is, always write for (var i = 0; ...) instead of for (i = 0; ...).

Don't

  • Use ES6.
    • It isn't implemented on all of the platforms that we support.
  • Use let (compatibility table).
  • Use const (compatibility table).

Suggested content

TL;DR

Update with instructions to clarify we are using ES6:

Follow the Google JavaScript style guide. New code should use ES6 language features like let, const, class, destructuring assignment, etc. where applicable.

I suggest following this with a new section:

Migration to ES6 and updated style guide

Blockly was was originally written in ES5.1 in compliance with an older, then-current version of the Google JavaScript Styleguide. We are migrating the codebase to ES6 and the new style guide. Older browsers, including Internet Explorer 10, will continue to be supported by transpilation to ES5.1 using the Closure Compiler.

When modifying existing code be consistent with whichever style is in use, but when writing new code ensure it complies with the new style guide, including using most ES6 features where applicable.

Do

Change var to let:

  • Redeclare variables in for loops. That is, always write for (let i = 0; ...) instead of for (i = 0; ...).

Don't

  • Remove mentioned items from this section.

Additional context

See #5026.

@cpcallen cpcallen added issue: docs Describes missing or incorrect documentation issue: triage Issues awaiting triage by a Blockly team member labels Jul 15, 2021
@cpcallen
Copy link
Contributor Author

(Updated description above with a change to the Do section.)

@rachel-fenichel rachel-fenichel added this to the 2021_q3_release milestone Jul 23, 2021
@rachel-fenichel rachel-fenichel removed the issue: triage Issues awaiting triage by a Blockly team member label Jul 23, 2021
@maribethb maribethb assigned maribethb and BeksOmega and unassigned maribethb Feb 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: docs Describes missing or incorrect documentation
Projects
None yet
Development

No branches or pull requests

5 participants