Linting & Formatting Standards
Relevant source files
The following files were used as context for generating this wiki page:
Linting and formatting standards in the Engineering Platform provide a unified foundation for code quality, consistency, and automated enforcement across all projects. These standards cover static code analysis, stylistic formatting, and commit message conventions to ensure long-term maintainability and reduced technical debt.
The system leverages industry-standard tools like ESLint, Prettier, and commitlint, integrated via Git hooks to automate compliance. This automated approach shifts quality checks "left" in the development lifecycle, catching issues during the commit phase rather than during manual code review.
Sources: README.md:12-18, CHANGELOG.md:113-116, skills/initialize/initialize-eng-platform.md:68-87
Architecture and Integration
The linting and formatting system is designed to be shared across projects via a Git submodule or npm packages. It integrates directly into the development workflow through a multi-layered validation approach.
The diagram shows how code changes flow through local verification tools before reaching CI/CD gates.
Sources: README.md:92-105, scripts/team-sync-check.js:37-64, skills/initialize/initialize-eng-platform.md:167-175
Key Components
| Component | Responsibility | Base Configuration |
|---|---|---|
| ESLint | Static analysis for logic errors and anti-patterns | configs/eslint/base.js |
| Prettier | Opinionated code formatting and style consistency | configs/prettier/.prettierrc.json |
| commitlint | Enforcement of Conventional Commits | configs/commitlint/commitlint.config.js |
| Husky | Orchestration of Git hooks (pre-commit, commit-msg) | .husky/ |
| lint-staged | Optimization to run linters only on modified files | package.json configuration |
Sources: README.md:112-120, skills/initialize/initialize-eng-platform.md:78-87, CHANGELOG.md:113-116
Code Quality Rules (ESLint)
The platform provides modular ESLint configurations that can be extended based on the project type (Base, TypeScript, or React).
Static Analysis Patterns
The code-analyze skill and base configs identify specific anti-patterns that degrade codebase health. Key areas of focus include:
- Logging: Excessive
console.logusage is flagged for migration to structured loggers. - Async Operations: Detection of synchronous operations (e.g.,
readFileSync) in async environments. - Complex Logic: Identification of complex functions (cyclomatic complexity > 10).
- Security: Scanning for hardcoded secrets, tokens, or credentials.
Sources: skills/code-analyze/SKILL.md:46-77, CHANGELOG.md:163-166
React Standards
The React-specific configuration enforces JSX best practices and modern React patterns.
// Example implementation pattern for project-level ESLint
module.exports = {
extends: [
'./.eng-platform/configs/eslint/base.js',
'./.eng-platform/configs/eslint/typescript.js',
'./.eng-platform/configs/eslint/react.js'
],
parserOptions: {
project: './tsconfig.json',
},
};
Sources: skills/initialize/initialize-eng-platform.md:54-62, README.md:112-114
Formatting (Prettier)
Formatting is handled by Prettier to eliminate "style wars" during code reviews. The configuration is standardized across the platform to ensure that every project adheres to the same spacing, quote, and trailing comma rules.
When initialized, the platform copies a standard .prettierrc.json to the project root and configures lint-staged to run Prettier automatically on supported file types including .ts, .tsx, .js, .jsx, .json, and .md.
Sources: skills/initialize/initialize-eng-platform.md:65-66, skills/initialize/initialize-eng-platform.md:86-87
Commit Standardization (commitlint)
To maintain a clean and searchable history, the platform enforces 100% compliance with Conventional Commits. This is managed via commitlint.config.js and a commit-msg Husky hook.
Sequence of commit message validation.
Sources: CHANGELOG.md:113-116, scripts/team-sync-check.js:52-64, skills/initialize/initialize-eng-platform.md:83-85
Enforcement and Synchronization
Standards are enforced locally through a team-sync-check.js script, which verifies that a developer's environment matches team requirements, including the presence of required Git hooks and Node.js versions.
Sync Verification Logic
The verification process checks the following:
- Node.js Version: Requires Version 20+.
- Git Hooks: Checks for the existence of
.husky/pre-commitand.husky/commit-msg. - Dependencies: Verifies
node_modulesare present. - Environment: Checks for
.envfiles and required variables.
Sources: scripts/team-sync-check.js:37-187
Implementation of lint-staged
The platform configures lint-staged in the project's package.json to optimize performance:
# Automated configuration during initialization
npm pkg set 'lint-staged["*.{ts,tsx,js,jsx}"]'='["eslint --fix", "prettier --write"]'
npm pkg set 'lint-staged["*.{json,md}"]'='["prettier --write"]'
Sources: skills/initialize/initialize-eng-platform.md:86-87
Summary
Linting and formatting standards within the Engineering Platform provide a robust framework for maintaining code quality. By automating ESLint, Prettier, and commitlint through Husky and lint-staged, the project ensures that all contributions meet a baseline of logic correctness and stylistic consistency. This automated enforcement reduces manual overhead during code reviews and facilitates a more stable, readable, and professional codebase across the entire engineering organization.