Hi, I'm Terence. Today let's talk about code standards in frontend engineering.
Clean and consistent code is not just about aesthetics. It directly affects collaboration speed, readability, maintainability, and defect rate. This article looks at code standards from three angles: mainstream industry guides, CSS naming approaches, and the tooling that helps teams keep standards in place.
Most frontend developers encounter style guides early in their careers. Some come from the language or framework itself, some from companies, and some from internal teams. The purpose is usually the same: make code more consistent and maintainable.
One of the most widely used JavaScript style guides. It covers JavaScript, React, and JSX, and strongly favors modern syntax such as arrow functions, template strings, and destructuring.
Pros
Cons
StandardJS is a zero-config JavaScript style guide. It aims to provide a consistent default without requiring developers to spend time debating formatting details.
Pros
Cons
Google publishes style guidance across many languages, including JavaScript. It emphasizes readability and consistency with strong documentation.
Pros
Cons
These standards mostly focus on JavaScript, but frontend work also depends heavily on CSS conventions.
CSS is easy to write and surprisingly hard to maintain at scale. Without a naming system, styles drift, selectors become hard to reason about, and conflicts pile up. Good naming conventions make code easier to read, reuse, and extend.
BEM stands for Block, Element, Modifier. It encodes component structure directly in the class name, such as block__element--modifier.
Pros
Cons
OOCSS, or Object-Oriented CSS, separates structure and skin and encourages extracting repeated styles into reusable objects.
Pros
Cons
SMACSS organizes styles into categories such as Base, Layout, Module, State, and Theme.
Pros
Cons
Standards become durable when they are reinforced by tools. Tooling should help teams produce consistent code, not create ceremony for its own sake.
ESLint checks JavaScript and TypeScript code against configurable rules and plugin ecosystems.
Pros
Cons
stylelint enforces style quality and consistency for CSS and related syntaxes.
Pros
Cons
commitlint validates commit messages against a rule set so history stays readable and structured.
Pros
Cons
Prettier formats code automatically so teams stop spending energy on spacing, wrapping, and punctuation debates.
Pros
Cons
These tools connect quality checks to Git hooks. Husky runs commands during Git events, and lint-staged applies checks only to staged files.
Pros
Cons
Two trends are already reshaping this area:
This is not really a future-only topic anymore. Many teams already run some version of it in their delivery pipeline.
Code standards are not meant to restrict individual expression for its own sake. Their real job is to reduce unnecessary variation so teams can focus on shipping good technical solutions.
Strong engineers are not defined by writing obscure, irreplaceable code. They are defined by solving real business and product problems with reliable technical judgment.