Author: Joe Callin Name: Joe Callin Title: Sr. Salesforce Developer Email: joe@jcallin.dev

Introduction

Purpose

This document establishes comprehensive coding standards and best practices for Lightning Web Component (LWC) development within your Salesforce project or codebase. These standards ensure consistency, maintainability, security, accessibility, and quality across all LWC code.

How to Use This Guide

Read Conventions and Structure first, then move through topics in order. Use each topic page as the source of truth for that concern, and use this page as the index into the full LWC standard.

Scope

These standards apply to all Lightning Web Components, including JavaScript, HTML templates, SASS/SCSS stylesheets, and component metadata files in the project. All code must comply with these standards and pass ESLint validation using the project's configuration.

Topics

  • Conventions and Structure - Naming conventions, file organization, component metadata, and import patterns
  • Component API - Property decorators, public methods, function patterns, and computed properties
  • Templates and Slots - Template directives, conditional rendering, iteration, and slot usage
  • Data and Platform - Wire adapters, Lightning Data Service, message channels, and navigation
  • Lifecycle and Events - Lifecycle hooks, event handling, and async patterns
  • Error Handling - Error states, toast notifications, and error boundary patterns
  • Accessibility - ARIA labels, keyboard navigation, semantic HTML, and Section 508 compliance
  • CSS - SASS/SCSS usage, CSS custom properties, SLDS integration, and scoped styles
  • Documentation - JSDoc requirements, inline comment guidelines, and documentation elements
  • Code Quality - Code style, complexity, performance, composition, security, and maintenance
  • Testing - Jest testing patterns, wire adapter mocking, and event testing

Change History

Version 2.1 - 2026-03-26

  • Refined hub navigation, related-document links, and topic descriptions for clearer wayfinding.
  • Polished section wording and structure while preserving the split-topic model from 2.0.

Version 2.0 - 2026-03-25

  • Restructured: split into hub page with topic subpages

Version 1.0 - 2026-01-14

  • Initial release of LWC coding standards documentation

Last Updated: 2026-03-26 Version: 2.1