TrendWhat rose on GitHub, every day at 07:30 KST · 한국어

GitHub · as of November 8, 2026 · View on GitHub →

ryanmcdermott/clean-code-javascript

JavaScript clean code guide

Set standards for writing readable and maintainable JavaScript

If fixing one function often requires touching other parts of the codebase, this guideline can help. It is a reference that adapts the principles from Robert C. Martin's 'Clean Code' to JavaScript syntax. It is not a style guide, but a guide on how to make code easier to read and fix.

From variable names to function structure

The guide proceeds in the order of variables, functions, objects, classes, SOLID principles, testing, concurrency, error handling, formatting, and comments. It recommends naming variables so their meaning is immediately clear and using the same vocabulary for the same kind of data. It advises splitting functions so they do only one thing and keeping arguments to two or fewer. It suggests avoiding conditionals where possible and using polymorphism instead of type checking. These principles are not strict rules, but reference points for teams to judge code quality.

Seeing the difference through specific code examples

Each item shows a 'bad example' and a 'good example' side by side.

  • Meaningful names Variable or function names should immediately reveal the intent of the code. Using searchable names helps in finding code later.
  • Single responsibility functions A function should do only one thing. Functions that do multiple things are hard to test and difficult to reuse.
  • Minimizing side effects Functions should minimize side effects that change external state. When modifying objects or arrays, it is safer to create and return a copy.

Start with the first draft of the code

This guide does not claim that all principles must be followed unconditionally. Since software engineering is still an evolving field, these principles are merely guidelines derived from long experience. Code cannot be perfect from the start, and all code begins as a first draft. The process of refining incomplete parts through peer review is important. Knowing these principles does not immediately make you a better developer, but it does provide a standard for refining code.

Things to check before applying

This repository is useful when setting code review standards in JavaScript projects. It is worth referencing when you want to reduce friction caused by inconsistent code styles among team members. However, since not all principles are suitable for every situation, they should be applied selectively according to project scale and team culture. If using TypeScript, advice related to type checking can be adjusted to leverage TypeScript's static type features. This guide covers general JavaScript principles that are not dependent on specific frameworks or libraries, making it applicable in various environments.

Written by AI from this repository's README on October 6, 2026. For the facts, the original on GitHub is the reference.

By the numbers

GitHub trending history
1 day between Jun 19, when Trend began recording, and Nov 8, 2026 · first on Jul 2 · best daily rank #17 (Jul 2)

Read from GitHub, as of November 4, 2026. None were read on November 8, 2026.

Language
JavaScript
Topics
best-practices · clean-architecture · clean-code · composition · inheritance · javascript · principles
Stars
94,691
Contributors
119
Forks
12,600
Commits
546
Last commit
February 11, 2023
Open issues
81
Open pull requests
43

View on GitHub →

README badge

trend.ondo.sh · GitHub daily trending #17 · July 2, 2026

The badge above shows the highest this repository has ranked on GitHub's daily trending since June 19, 2026, and the day it did. Paste the Markdown below into your README. The badge opens this page, and it updates by itself when the repository climbs higher.

[![trend.ondo.sh](https://trend.ondo.sh/github/r/ryanmcdermott--clean-code-javascript/badge.en.svg)](https://trend.ondo.sh/github/r/ryanmcdermott--clean-code-javascript/en.html)