VOOZH about

URL: https://deepwiki.com/Digilac/simap-mcp/6.3-code-quality-and-standards

⇱ Code Quality and Standards | Digilac/simap-mcp | DeepWiki


Loading...
Menu

Code Quality and Standards

Purpose and Scope

This page documents the code quality standards, naming conventions, formatting rules, and linting configuration used in the simap-mcp project. It specifies the tools, configurations, and practices that ensure consistency and maintainability across the codebase. As of v1.3.0, the project requires Node.js >=22 for development and execution CONTRIBUTING.md31

For information about the development workflow and pull request process, see 9.1 How to Contribute For testing strategies and test execution, see 6.4 Testing


Quality Toolchain Overview

The project uses four primary quality tools, each configured and invoked through npm scripts defined in package.json.

Title: Quality Toolchain and Data Flow


Sources: CONTRIBUTING.md48-60 tsconfig.json1-17 eslint.config.js1-21

Tool Responsibilities

ToolPurposeConfigurationnpm Script
PrettierEnforces consistent code formatting (spacing, quotes, semicolons).prettierrc1-7npm run format
ESLintDetects code quality issues, unused variables, type violationseslint.config.js1-21npm run lint
TypeScriptValidates type safety, compiles to JavaScripttsconfig.json1-17npm run typecheck
VitestExecutes unit tests, validates behaviorCONTRIBUTING.md58-59npm test

Sources: CONTRIBUTING.md48-60 tsconfig.json1-17 eslint.config.js1-21 .prettierrc1-7


TypeScript Standards

The project enforces strict TypeScript standards to maximize type safety and prevent runtime errors.

Compiler Configuration

Key TypeScript compiler options from tsconfig.json:

OptionValuePurpose
stricttrueEnables all strict type-checking options tsconfig.json8
target"ES2023"Compiles to modern JavaScript tsconfig.json3
module"NodeNext"Modern module resolution for Node.js tsconfig.json4-5
forceConsistentCasingInFileNamestruePrevents case-sensitivity issues tsconfig.json11

Type Safety Rules

Title: Natural Language Requirements to TypeScript Entities


Sources: tsconfig.json8 CONTRIBUTING.md131-150 CONTRIBUTING.md190-195

Public API Guidelines

The project uses strict mode to ensure robustness. The use of any is discouraged in favor of more specific types or unknown.

Sources: tsconfig.json8 eslint.config.js14 CONTRIBUTING.md131-150 CONTRIBUTING.md190-195


Naming Conventions

The project follows strict naming conventions to maintain consistency across files, functions, classes, and MCP tools.

Convention Summary

ElementConventionExamples
Fileskebab-casesearch-cpv.ts
FunctionscamelCaseregisterSearchCpv
ClassesPascalCaseSimapClient
ConstantsUPPER_SNAKESIMAP_API_BASE
MCP Toolssnake_casesearch_cpv_codes
Types/InterfacesPascalCaseSearchXxxInput

Sources: CONTRIBUTING.md150 CONTRIBUTING.md196-205

Naming Patterns in Code

Title: System Names to Code Identifiers


Sources: CONTRIBUTING.md123-129 CONTRIBUTING.md196-205


Code Formatting

Prettier enforces consistent code formatting automatically as defined in .prettierrc.

Formatting Rules

RuleValueConfiguration Key
Indentation2 spaces"tabWidth": 2
SemicolonsRequired"semi": true
QuotesDouble quotes"singleQuote": false
Trailing CommasES5"trailingComma": "es5"
Line Width90 characters"printWidth": 90

Sources: CONTRIBUTING.md207-212 .prettierrc1-7


Linting Configuration

ESLint analyzes code for quality issues, enforcing TypeScript best practices. Configuration is defined in eslint.config.js using the modern flat config format.

ESLint Rule Set

The project uses typescript-eslint with several specific overrides:

  • Unused Variables: Errors on unused variables unless prefixed with an underscore (_) eslint.config.js9-12
  • Explicit Returns: Explicit function return types are not strictly required (off) to allow for inference where appropriate eslint.config.js13
  • No Explicit Any: Usage of any triggers a warning to encourage safer types eslint.config.js14

Sources: eslint.config.js1-21


Quality Gates

Before code is considered production-ready, it must pass several checks as defined in the development workflow. Note that Node.js 22+ is required for these gates CONTRIBUTING.md31

  1. Compilation: npm run build must succeed CONTRIBUTING.md50 CONTRIBUTING.md107
  2. Type Checking: npm run typecheck (tsc --noEmit) must pass CONTRIBUTING.md57 CONTRIBUTING.md106
  3. Testing: npm test must pass all vitest suites CONTRIBUTING.md58 CONTRIBUTING.md108
  4. Linting: npm run lint must pass without errors CONTRIBUTING.md53 CONTRIBUTING.md105
  5. Formatting: Code must be checked via npm run format:check CONTRIBUTING.md56

Sources: CONTRIBUTING.md46-60 CONTRIBUTING.md102-110 eslint.config.js1-21