Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Sep 2, 2023. It is now read-only.

JavaScript Style Guide

NotificationsYou must be signed in to change notification settings

ripple/javascript-style-guide

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 

Repository files navigation

The Ripple Labs style guide is defined by the eslintrc file in this repository along with the supplemental rules listed below.

Additional Rules not covered by ESLint

  • Declare variables in the deepest possible block and as close to their use as possible (the linter will catch issues with hoisting)
  • Use soft tabs set to 2 spaces
  • Use a leading underscore_ when naming private properties
  • Usestack.push(x) instead ofstack[stack.length] = x
  • Copy arrays withArray.slice
  • Convert array-like objects to arrays withArray.prototype.slice.call(arguments)
  • Strings longer than 80 characters should be written across multiple lines using string concatenation.
  • Never name a parameterarguments, this will take precedence over thearguments object that is given to every function scope.
  • Assign methods to the prototype object, instead of overwriting the prototype with a new object. Overwriting the prototype makes inheritance impossible: by resetting the prototype you'll overwrite the base!
  • When attaching data payloads to events (whether DOM events or something more proprietary like Backbone events), pass a hash instead of a raw value. This allows a subsequent contributor to add more data to the event payload without finding and updating every handler for the event. For example, instead of:

Editor Configuration

It is recommended that you configure your text editor to show linter errors while you are typing.

Sublime Text 3

Note that Sublime Text can optionally be configured for vim or emacs key bindings.

Jetbrains products (IDEA, WebStorm)

https://www.jetbrains.com/webstorm/help/eslint.html

  • npm install -g eslint
  • Enable ESLint fromFile > Settings > Languages and Frameworks > JavaScript > Code Quality Tools > ESLint
  • Point "ESLint package" to the installed eslint (osx default/usr/local/lib/node_modules/eslint)

TODO: Write ESLint rules for

  • Never name a parameterarguments
  • Never assign<Function>.prototype = ...
  • Warn when a variable is explicitly re-assigned

Resources

The rules in the previous section are from theAirbnb Style Guide

About

JavaScript Style Guide

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp