-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
43 additions
and
45 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
Yay! We love PRs! 🎊 | ||
|
||
Please include a description of your change & check your PR against this list, thanks: | ||
Please include a description of your change and ensure: | ||
|
||
- [ ] Commit message has a short title & issue references | ||
- [ ] Each commit does a logical chunk of work. | ||
- [ ] It builds and tests pass (e.g `gulp tslint`) | ||
- [ ] Each commit does a logical chunk of work. | ||
- [ ] It builds and tests pass (e.g `gulp`) | ||
|
||
More info can be found by clicking the "guidelines for contributing" link above. | ||
More info can be found on our [contribution guide](https://github.com/VSCodeVim/Vim/blob/master/.github/CONTRIBUTING.md). |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,32 @@ | ||
## Style Guide | ||
|
||
In addition, to VS Code's [coding guidelines](https://github.com/Microsoft/vscode/wiki/Coding-Guidelines), please adhere to the following: | ||
|
||
* Use `for ... of` whenever possible | ||
|
||
**Rationale:** `for ... of` is awesome. It's more readable than any other variant. | ||
**Rationale:** `for ... of` is awesome. It's more readable than any other variant. | ||
|
||
* Don't use `any` as much as possible | ||
|
||
**Rationale:** The language is called *Type*Script, not *Untyped*Script. :wink: Static typing is wonderful. It catches bugs and improves readability. We should strive to use it as much as possible. | ||
**Rationale:** The language is called *Type*Script, not *Untyped*Script. :wink: Static typing is wonderful. It catches bugs and improves readability. We should strive to use it as much as possible. | ||
|
||
* Use `const` wherever possible. | ||
|
||
**Rationale:** Instead of reading `const` as "constant value," read it as "single assignment." Yes, it means "constant value" in other programming languages, but it's a little different in JavaScript. | ||
**Rationale:** Instead of reading `const` as "constant value," read it as "single assignment." Yes, it means "constant value" in other programming languages, but it's a little different in JavaScript. | ||
|
||
* When we can't use `const`, use `let`; never `var` | ||
|
||
**Rationale:** `var` trips up programmers in a number of cases - hoisting and closure capture are two big ones. Consider the difference between | ||
**Rationale:** `var` trips up programmers in a number of cases - hoisting and closure capture are two big ones. Consider the difference between | ||
|
||
``` | ||
for (var j = 0; j < 5; j++) { setTimeout(() => console.log(j), 5) } | ||
``` | ||
|
||
`for (var j = 0; j < 5; j++) { setTimeout(() => console.log(j), 5) }` | ||
and | ||
|
||
and | ||
``` | ||
for (let j = 0; j < 5; j++) { setTimeout(() => console.log(j), 5) } | ||
``` | ||
|
||
`for (let j = 0; j < 5; j++) { setTimeout(() => console.log(j), 5) }` | ||
Even if you're not capturing the variable, who knows if someone else might later? | ||
|
||
Even if you're not capturing the variable, who knows if someone else might later? |