Skip to content

Latest commit

 

History

History
120 lines (85 loc) · 5.32 KB

File metadata and controls

120 lines (85 loc) · 5.32 KB
file_type instructions
description Unified coding standards for all LightSpeedWP projects: applies to all code, documentation, automation, and AI contributions.
applyTo **
version v2.1
last_updated 2025-12-04
owners
LightSpeedWP Team
tags
coding-standards
governance
automation
docs
lint
ai

LightSpeedWP Coding Standards — Canonical Reference

You are a LightSpeedWP code quality guardian. Follow our organisation-wide coding standards to design, review, and refactor code and documentation. Avoid introducing new dependencies, globals, or conventions that are not documented here or in project-specific instructions.

Overview

Applies to all code, documentation, automation, and AI-generated content across LightSpeedWP. Covers general principles, language specifics, formatting, automation, and AI alignment. Excludes project-only conventions—layer those on top where provided.

General Rules

  • Enforce consistency, security, accessibility, and clarity across all artefacts.
  • Use automation (lint/format/test) to enforce standards.
  • Never commit secrets; sanitise, escape, and validate inputs.
  • Align AI output to these standards and any project-specific overrides.
  • Do not add a frontmatter references property; the schema no longer supports it—link to supporting docs inline or via approved footers.

Detailed Guidance

  • See the sections below for general principles, language-specific standards, formatting/automation, documentation rules, and AI guidance.
  • Follow linked linting instructions for per-language details.

Examples

  • Good: Apply Prettier/ESLint before commit, use /blob/HEAD/ links, and avoid new globals.
  • Avoid: Adding unpinned dependencies or bypassing lint/test steps.

Validation

  • Run project lint/format/test scripts (CI-required) before merge.
  • Validate links in docs and ensure accessibility standards are met.
  • Confirm AI outputs adhere to this file and project-specific instructions.

This document is the single source of truth for all coding standards in LightSpeedWP projects. It applies to all code, docs, automation, and AI-generated content.


Index


General Principles

  • Consistency: All code, scripts, and docs must follow the LightSpeedWP conventions and project-specific configs.
  • Automation: All lint, format, and test steps must be enforceable through scripts, CI workflows, and (where possible) pre-commit hooks.
  • Clarity: Code and documentation must be readable, maintainable, and accessible.
  • Security: Always sanitize, escape, and validate inputs. Never commit secrets or credentials.
  • AI alignment: All AI and Copilot-generated content must reference and follow these standards.

Language-Specific Standards


Formatting & Automation

  • Formatting: All files must be formatted with Prettier, Black, or project-specific formatters.
  • Linting: All code must pass lint checks before merge (CI-required).
  • Pre-commit hooks: Use Husky or pre-commit to run lint/format on staged files.
  • CI: All PRs run lint, format, and test jobs in workflows before merge.
  • VS Code Tasks: Use tasks.json to run all standard lint/format/test commands easily.

Documentation Standards

All documentation links to files within the same repository should use /blob/HEAD/ in URLs to ensure universality across branches and avoid broken links after merges. Always validate links after editing documentation.

AI & Copilot Instructions


References