SkillAgentSearch skills...

Idiomatic.js

Principles of Writing Consistent, Idiomatic JavaScript

Install / Use

/learn @rwaldron/Idiomatic.js
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Principles of Writing Consistent, Idiomatic JavaScript

This is a living document and new ideas for improving the code around us are always welcome. Contribute: fork, clone, branch, commit, push, pull request.

All code in any code-base should look like a single person typed it, no matter how many people contributed.

The following list outlines the practices that I use in all code that I am the original author of; contributions to projects that I have created should follow these guidelines.

I do not intend to impose my style preferences on other people's code or projects; if an existing common style exists, it should be respected.

"Arguments over style are pointless. There should be a style guide, and you should follow it"

Rebecca Murphey

 

"Part of being a good steward to a successful project is realizing that writing code for yourself is a Bad Idea™. If thousands of people are using your code, then write your code for maximum clarity, not your personal preference of how to get clever within the spec."

Idan Gazit

Translations

Important, Non-Idiomatic Stuff:

Code Quality Tools, Resources & References

Get Smart

Annotated ECMAScript 5.1

EcmaScript Language Specification, 5.1 Edition

The following should be considered 1) incomplete, and 2) REQUIRED READING. I don't always agree with the style written by the authors below, but one thing is certain: They are consistent. Furthermore, these are authorities on the language.

Build & Deployment Process

Projects should always attempt to include some generic means by which source can be linted, tested and compressed in preparation for production use. For this task, grunt by Ben Alman is second to none and has officially replaced the "kits/" directory of this repo.

Test Facility

Projects must include some form of unit, reference, implementation or functional testing. Use case demos DO NOT QUALIFY as "tests". The following is a list of test frameworks, none of which are endorsed more than the other.

Table of Contents


Preface

The following sections outline a reasonable style guide for modern JavaScript development and are not meant to be prescriptive. The most important take-away is the law of code style consistency. Whatever you choose as the style for your project should be considered law. Link to this document as a statement of your project's commitment to code style consistency, readability and maintainability.

Idiomatic Style Manifesto

  1. <a name="whitespace">Whitespace</a>
  • Never mix spaces and tabs.
  • When beginning a project, before you write any code, choose between soft indents (spaces) or real tabs, consider this law.
    • For readability, I always recommend setting your editor's indent size to two characters — this means two spaces
View on GitHub
GitHub Stars25.7k
CategoryContent
Updated21h ago
Forks3.6k

Security Score

80/100

Audited on Mar 27, 2026

No findings