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

Cleanup JS style guide. #61

Closed
wants to merge 1 commit into from
Closed

Cleanup JS style guide. #61

wants to merge 1 commit into from

Conversation

eddieajau
Copy link
Contributor

  • Added .gitignore
  • Pulled some common elements out of the JS guide into the basic guidelines.
  • Added clarification about indenting and alignment.
  • Cleaned up JS styles guide to follow the PHP style more closely.
  • Removed coding guides from JS (these need more thought, some recommendations where wrong because I suspect they were out of date, and they should probably be moved to an appendix anyway).
  • Forced all code blocks, even one-liners to be wrapped in curly braces (too many a bug I've seen happen when we don't do this consistently).

Note, I'm propose that the else keyword start on its own line rather than used inline. I think this makes for a better read but it's not a hill I'm prepared to die on.


`var element = document.getElementById('elementId');`

**Iterators are the exception**
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this because it should be up to the developer to choose. Opinion is divided over whether i is best practice or not.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opinions are also divided on tabs vs spaces. It is precisely one of the reasons style guides exist, for a particular project to provide their expectations of syntax, especially when debatable (and mostly futile), for consistencies sake.

@photodude
Copy link
Contributor

@eddieajau What do you want to do with this PR considering the branch has conflicts and we are moving away from the gh pages (see PR #141 )

@eddieajau
Copy link
Contributor Author

I think it's safe to say it can be closed for want of a seconder :)

@eddieajau eddieajau closed this Jan 22, 2017
wilsonge pushed a commit to wilsonge/coding-standards that referenced this pull request Oct 1, 2018
use object oriented style property
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

Successfully merging this pull request may close these issues.

6 participants