Skip to content

Instantly share code, notes, and snippets.

@jehoshua02
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jehoshua02/fa8a524a156f4d93d290 to your computer and use it in GitHub Desktop.
Save jehoshua02/fa8a524a156f4d93d290 to your computer and use it in GitHub Desktop.
Ideas for front-end coding standards.

Ideas for Front-end Coding Standards

Package Managers

Use flags with command line tools to record dependencies in tracked files:

  • package.json (npm)
  • bower.json (bower)

Installed files should be ignored unless there is good reason to track:

  • node_modules (npm)
  • bower_components (bower)

And with bower, we like moving files where needed rather than exposing everything in the public directory.

Automation

We like automating things, like build steps, testing, deployment, etc.

Testing

Performance

We like to compile resources down to a minimal number of minified files for the browser.

Build Tools

We like using Gulp.js for build tasks.

Javascript

Code Organization

  • AVOID GLOBALS AS MUCH AS HUMANLY POSSIBLE.
  • CommonJS: break things into small, reusable, single-purpose modules. Avoid globals.
  • React.js: encapsulate complex logic in many small, reusable, single-purpose components.
  • Webpack: bundle all our small modules and components up into a few optimized files for the browser.
  • APIS + Client Side Applications = Happy Developers

Javascript Code Formatting

  • jshint: automatically check code formatting.
  • editorconfig: shared editor configurations across the team to make it easy to adhere to coding standards when they differ per technology.

There's a lot of good stuff here that I would adopt:

https://github.com/rwaldron/idiomatic.js#idiomatic-style-manifesto

Misc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment