StandardJS

JavaScript Code Style for today!

What a Style Guide

is NOT

  • Step by step instructions on how to complete a task or multiple tasks.
  • Development ideology or design pattern. ( SOLID / DRY )
  • Something to tell you how to program

Why use a

Style Guide

Additional Constraints / Usage Standards

Enforce Style / Composition

Improve Communication / Consistency

Style Guides

Writing:

  • Modern Language Association - MLA

Popular Style Guides

MLA gives you stylistic direction for common tasks and conventions

Style Guides

Work Citation with MLA:

Author:

"Begin the entry with the author’s last name, followed by a comma and the rest of the name, as presented in the work. End this element with a period."

Example:

Katz, Eric N. Culture and Imperialism. PublishingCo, 1999.

Style Guides

Work Citation with MLA:

Publication Date:

"The same source may have been published on more than one date, such as an online version of an original source. For example, a television series might have aired on a broadcast network on one date, but released on Netflix on a different date. When the source has more than one date, it is sufficient to use the date that is most relevant to your use of it.... "

Example:

“Hush.” Buffy the Vampire Slayer, created by Joss Whedon, performance by Sarah Michelle Gellar, season 4, Mutant Enemy, 1999.

Style Guides

How do you handle punctuation of bulleted lists in MLA?

MLA does not include documentation for this.

List of things I like:

  • Dogs
  • Family
  • JavaScript
  • CSS

 

  • Dogs;
  • Family.
  • JavaScript?
  • CSS!?

Style Guides

Does a styleguide need to cover everything?

Is standardization of conventions important in every use-case?

Maybe follow another Style Guide?

  • Chicago Manual of Style
  • APA
  • McGill

Style Guides

Documentation:

Code Stuff { }

Style Guides help us solve these types of discrepancies.

What does this code do?

if( isTrue ) {
 a = 1;
}
else {
 a = 2;
}
if(isTrue) { 
 a=1;
}
else{
 a=2;
}
if ( isTrue ) { 
 a = 1
} else {
 a = 2
}
a = ( isTrue ) ? 1 : 2

Style Guides

  • Enforces best practices.  (Usage Standards)
  • Improves readability. (Composition)      
  • Establishes consistency in files. (Consistency)               

StandardJS

By Eric Katz

StandardJS

  • 431
Loading comments...

More from Eric Katz