exportcase

Opinionated file name validator for TypeScript.

Rules

  • At most one named export per file
  • File name must match the named export or default export
  • Star exports (export * from ...) are only allowed in index.ts or index.tsx files
  • Files with no exports are allowed

Installation

$ npm install exportcase

Usage

$ npx exportcase check ./src Checking TypeScript files in: src Found TypeScript file with error: src/generate-id.ts No default export Named exports: - generateUUID Errors: ❌ Filename 'generate-id' does not match any export ❌ Found 1 files with naming convention errors
github npm