DesignSystems.One Logodesignsystems.one
FoundationsDesign SystemsFrameworksDesignOpsTools

DesignSystems.One © 2025

Contact

Code Standards

Consistent coding standards ensure maintainability, readability, and scalability of our design system.

File Structure

Directory Structure

app/                  # Next.js App Router
├── (routes)/          # App routes
├── components/        # Shared components
│   ├── ui/            # Base UI components
│   └── [feature]/     # Feature-specific components
├── hooks/             # Custom React hooks
├── lib/               # Utility functions and libraries
├── styles/            # Global styles
└── types/             # TypeScript type definitions

Naming Conventions

  • Files: Use kebab-case for file names (e.g., button-group.tsx)
  • Components: Use PascalCase for component names (e.g., ButtonGroup)
  • Hooks: Prefix with "use" (e.g., useMediaQuery)
  • Utilities: Use camelCase (e.g., formatDate)

Do

// button.tsx
export function Button({ children }) {
  return <button>{children}</button>;
}

Don't

// Button_Component.tsx
export default function button_component({ children }) {
  return <button>{children}</button>;
}
Code Formatting

Tools

  • Prettier: Use for automatic code formatting
  • ESLint: Use for code quality and style enforcement
  • TypeScript: Use strict mode for type checking

Configuration Files

// .prettierrc
{
  "semi": false,
  "singleQuote": true,
  "tabWidth": 2,
  "trailingComma": "es5"
}

// .eslintrc
{
  "extends": [
    "next/core-web-vitals",
    "prettier"
  ],
  "rules": {
    "react/no-unescaped-entities": "off"
  }
}
Commit Hooks
Use Husky and lint-staged to enforce code standards before commits. This ensures all code in the repository meets our standards.

Additional Resources

Style Guides & Linting
  • ESLint - Pluggable JavaScript linter
  • Prettier - Opinionated code formatter
  • Stylelint - A mighty CSS linter
  • Airbnb JavaScript Style Guide
Testing Libraries
  • Jest - JavaScript testing framework
  • React Testing Library - Testing utilities
  • Storybook - UI component development environment
  • Cypress - End-to-end testing