Open-source project
ryanmcdermott/clean-code-javascript avatar
ryanmcdermott/clean-code-javascript

clean-code-javascript: three files, one README, and no tool to run

Clean Code concepts adapted for JavaScript

94,761 stars12,589 forksJavaScriptMIT

At a glance

What is it?
ryanmcdermott/clean-code-javascript restates the principles from Robert C. Martin's Clean Code as JavaScript examples. The repository is a document, not a program: three entries at the root, no package manifest, no linter configuration, and two rules that quietly change behaviour if you apply them mechanically.
Who is it for?
Use this guide as a review checklist on code your team already argues about, and read the two behavioural rules closely before adopting either one. Do not install anything on its account, because the repository is three files and the tooling it names lives in other projects, so a team wanting enforcement has to choose its own linter and configuration first.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Probably not. The repository last received commits 26 months ago, on July 29, 2024.
What is it written in?
Mainly JavaScript, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 29, 2026, and from our analysis. They are not legal advice.

Editorial analysis

The repository is a README, a LICENSE, and a .gitattributes

Look at the root and there are three entries: .gitattributes, LICENSE and README.md. That is the whole project. There is no package manifest, no source directory, no test runner, no continuous integration configuration, no linter setup, and no GitHub releases. The repository record carries no homepage either.

Consequence for the reader: there is nothing to install and nothing to execute. The two tools the guide names, buddy.js and ESLint, are other people's projects, and the ESLint reference is a link to one pinned commit of its no-magic-numbers rule, so following it lands you in a different repository's documentation rather than in a working setup. Adopting this guide means carrying your own tooling and using the document as a review checklist, and the gap between a rule you agree with and a rule your editor enforces is the gap you have to close yourself.

It says outright that it is not a style guide

The introduction states that these are software engineering principles from Robert C. Martin's book Clean Code, adapted for JavaScript, and then immediately limits what it is offering: this is not a style guide, it is a guide to producing readable, reusable and refactorable software. It goes further and says not every principle has to be strictly followed, that even fewer will be universally agreed upon, and that these are guidelines and nothing more, though they are ones codified over many years of collective experience by the authors of Clean Code.

Consequence for the reader: the document removes the authority you would need to enforce it. If a team adopts it as a standard, it is promoting a set of guidelines its own author declined to make mandatory, and the disagreement the author anticipates turns into a policy argument instead of a judgement call at review time. The honest use is to argue from the reasoning, not to cite the file as a rule that has already been settled.

The strongest claim it makes is about first drafts

The most direct sentences in the introduction are about expectations rather than syntax. Knowing these will not immediately make you a better developer, and working with them for many years does not mean you will not make mistakes. Every piece of code starts as a first draft, like wet clay being shaped, and the imperfections come out when you review it with your peers. The line that follows is the sharpest: do not beat yourself up for first drafts that need to improve, beat up the code instead. The same passage concedes that software engineering is a bit over fifty years old and that harder rules may have to wait until the craft is older.

Consequence for the reader: this is advice about a review culture, and the repository supplies no automation for any of it, so the entire return on reading the guide depends on whether your team actually reviews code. In a team that does not, the document changes nothing measurable, and the effort of adopting its vocabulary is wasted. In a team that does, the framing tells you what the document is for, which is settling an argument in a review rather than preventing one.

The default-parameter rule has a hole, and the README names it

One variables rule prefers default parameters over short circuiting, and it carries a warning in the same paragraph: a default value is supplied only for an undefined argument. Other falsy values, written out as an empty string, false, null, zero and NaN, will not be replaced. The recommended form is a parameter with the default in the signature:

javascript
function createMicrobrewery(name = "Hipster Brew Co.") {
  // ...
}

Consequence for the reader: replacing `name || "Hipster Brew Co."` with this is a behaviour change dressed as a cleanup. A caller that passes an empty string or a zero previously received the fallback and now passes the falsy value straight through, and the difference only appears at the boundary, in a test that happens to use a real value. This is the one place in the guide where a mechanical refactor introduces a defect, and the warning is a parenthetical rather than a heading, so a reader skimming rule titles will miss it.

Destructuring clones primitives and nothing else

The functions section argues for one or two arguments, says three should be avoided if possible, and attributes the limit to testing: more than three leads to a combinatorial explosion of cases to cover. It recommends destructuring an object argument instead, and lists four advantages. The third is the one that matters:

javascript
function createMenu({ title, body, buttonText, cancellable }) {
  // ...
}

Destructuring, the entry says, clones the specified primitive values of the argument object, which can help prevent side effects, with a note that objects and arrays destructured from the argument object are not cloned. Consequence for the reader: the protection stops at the primitive boundary. Destructuring a nested object hands you the caller's own reference, so mutating it inside your function still mutates the caller's data, and the property looks local while it is not. The rule reads as a safety property and is a partial one, and the caveat is the last sentence of a four-item list. The argument-count rule has the same shape, since it tells you four parameters is too many without saying what shape to consolidate them into.

Searchable names depend on a tool you have to pick

The searchable-names rule rests on an argument about reading rather than writing: we read far more code than we ever write, and a name that carries no meaning hurts the reader. The example is a timeout with a literal in it and a comment asking what 86400000 is for, answered by naming the constant:

javascript
const MILLISECONDS_PER_DAY = 60 * 60 * 24 * 1000; //86400000;

setTimeout(blastOff, MILLISECONDS_PER_DAY);

The rule then names buddy.js and ESLint as tools that can help identify unnamed constants. Consequence for the reader: searchable is not a property of the name, it is a property of whether your editor and your reviewer can find it, and this repository ships no configuration for either. Following the ESLint link gets you documentation for a rule in somebody else's project, and buddy.js is a separate dependency you have to find and judge for yourself. Two developers who follow this guide can end up with entirely different enforcement, and neither can claim to be following the repository.

Twelve sections, and the table of contents is the whole map

The document opens with a numbered list of twelve entries: Introduction, Variables, Functions, Objects and Data Structures, Classes, SOLID, Testing, Concurrency, Error Handling, Formatting, Comments, and Translation. Section headings are set in bold, and each rule in the variables section closes with a back-to-top link pointing at the table of contents, which tells you the file was written to be read in a browser from the top down.

Consequence for the reader: there is no index by language version and no marker of which rules assume modern syntax. The functions section names ES2015/ES6 once, when it recommends destructuring, and no other entry states a floor, so a project targeting older browsers has to work that out rule by rule. The back-to-top link after every rule is a reading affordance rather than a lookup one, and a reviewer checking a single convention has to scroll to find it. The twelfth entry, Translation, indicates the document is meant to be forked, and the absence of a recorded homepage leaves no second location where a fork could be versioned.

Editorial conclusion

Use this guide as a review checklist on code your team already argues about, and read the two behavioural rules closely before adopting either one. Do not install anything on its account, because the repository is three files and the tooling it names lives in other projects, so a team wanting enforcement has to choose its own linter and configuration first. Before you make any of it a standard, settle two things: whether your team reviews code at all, since the value the document claims depends on that, and whether you accept that its own author calls these guidelines rather than rules. Check the version question per rule rather than assuming, because only one entry names a language version and the rest say nothing.

Frequently asked questions

Is clean code still relevant?

The guide's own position is that these are guidelines and nothing more, that not every principle has to be strictly followed, and that even fewer will be universally agreed upon. It adds that software engineering is a bit over fifty years old and that harder rules may have to wait until the craft is older, and that knowing the principles will not immediately make you a better developer.

What are the top 10 principles of clean code?

The document has twelve sections, of which Variables is the one worked through in most detail. Its rules include using meaningful and pronounceable names, using the same vocabulary for the same type of variable, using searchable names, using explanatory variables, avoiding mental mapping, not adding unneeded context, and preferring default parameters over short circuiting.

Does clean-code-javascript have any code I can install?

No. The repository holds three entries at its root, .gitattributes, LICENSE and README.md, with no package manifest, no source directory and no test runner. It publishes no GitHub releases and records no homepage, so the guide is the entire project and there is nothing to install.

Which JavaScript version do these rules assume?

The README names one version explicitly, referring to ES2015/ES6 destructuring syntax when it recommends an object argument in the functions section. No other entry states a language floor, and the repository does not map any rule to a version, so a project targeting older browsers has to work that out per rule.

Official sources

  1. Official README
  2. Project repository