Repolode
ryanmcdermott

ryanmcdermott/clean-code-javascript

A guide applying Robert C. Martin's Clean Code principles to JavaScript, with bad/good code examples for naming, functions, classes and SOLID.

Stars
94,723
Forks
12,568
Open issues
124
Last commit
2 years ago

What is it?

This repository adapts the software engineering principles from Robert C. Martin's book Clean Code to JavaScript. It is framed as a set of guidelines for writing readable, reusable and refactorable code rather than a formal style guide, and each rule is illustrated with a "Bad" and a "Good" code example.

The guide covers variables and naming, function design (argument count, single responsibility, avoiding side effects and flags), objects and data structures, classes (ES2015 classes, composition over inheritance, method chaining), and the SOLID principles. Later sections touch on testing, concurrency, error handling, formatting and comments.

It is most useful for developers who want concrete, code-level examples of clean code habits in JavaScript, or teams using it as a basis for code review discussions.

Key features

  • 01Bad/good code comparisons for each principle
  • 02Covers naming, functions, objects and classes
  • 03Includes SOLID principles with JavaScript examples
  • 04Discusses avoiding side effects and immutability
  • 05Offers guidance on when to prefer composition over inheritance

Use cases

  • Learning clean code habits as a JavaScript developer
  • Preparing material for code review guidelines within a team
  • Refactoring legacy JavaScript into more readable, modular code

Topics

FAQ

What is clean-code-javascript?
A guide applying Robert C. Martin's Clean Code principles to JavaScript, with bad/good code examples for naming, functions, classes and SOLID. This repository adapts the software engineering principles from Robert C. Martin's book Clean Code to JavaScript. It is framed as a set of guidelines for writing readable, reusable and refactorable code rather than a formal style guide, and each rule is illustrated with a "Bad" and a "Good" code example.
Is clean-code-javascript free to use? What license does it have?
clean-code-javascript is open source under the MIT license. Check the license terms before using it in commercial products.
Is clean-code-javascript still maintained?
No commits for 6+ months. The last commit to clean-code-javascript was on Jul 29, 2024.
What can I use clean-code-javascript for?
Learning clean code habits as a JavaScript developer Preparing material for code review guidelines within a team Refactoring legacy JavaScript into more readable, modular code
Where can I get clean-code-javascript?
The source code and installation instructions are on GitHub: https://github.com/ryanmcdermott/clean-code-javascript

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects