Skip to main content

Configuration Schema

The Rev-dep configuration file uses a structured JSON schema that defines how your codebase should be analyzed and governed.

Supported File Names

Rev-dep looks for configuration files in this order:
  • .rev-dep.config.jsonc (recommended - supports comments)
  • .rev-dep.config.json
  • rev-dep.config.jsonc
  • rev-dep.config.json
Use .jsonc extension for JSON with Comments support, allowing you to document your configuration.

Root Properties

configVersion
string
required
Configuration version string. Current version: "1.6"Ensures compatibility between your config file and the CLI version.
$schema
string
JSON schema URL for editor validation and autocompletion.
"$schema": "https://github.com/jayu/rev-dep/blob/master/config-schema/1.6.schema.json?raw=true"
Enables IntelliSense in VS Code and other editors.
rules
array
required
Array of rule objects. Each rule targets a specific directory and defines checks for that scope.See Rules for detailed documentation.
conditionNames
string[]
Array of condition names for package.json exports resolution.
"conditionNames": ["import", "node", "default"]
Controls which conditional exports are resolved when analyzing imports. Common conditions:
  • "import" - ES modules
  • "require" - CommonJS
  • "node" - Node.js environment
  • "default" - Fallback condition
  • Custom conditions specific to your build tools
customAssetExtensions
string[]
Additional asset extensions treated as resolvable imports.
"customAssetExtensions": ["glb", "mp3", "woff2"]
Default list already covers common extensions for fonts, images, and config files. Use this to add project-specific asset types.
Extensions should not include the leading dot (use "mp3" not ".mp3").
ignoreFiles
string[]
Global file patterns to ignore across all rules.
"ignoreFiles": ["dist/**/*", "build/**/*", "*.min.js"]
Git-ignored files are skipped by default. Use this for additional exclusions.

Quick Start Example

{
  "configVersion": "1.6",
  "$schema": "https://github.com/jayu/rev-dep/blob/master/config-schema/1.6.schema.json?raw=true",
  "rules": [
    {
      "path": ".",
      "prodEntryPoints": ["src/main.tsx", "src/pages/**/*.tsx"],
      "devEntryPoints": ["scripts/**", "**/*.test.*"],
      "unusedExportsDetection": {
        "enabled": true,
        "autofix": true
      },
      "orphanFilesDetection": {
        "enabled": true,
        "autofix": true
      },
      "unusedNodeModulesDetection": { 
        "enabled": true 
      },
      "circularImportsDetection": { 
        "enabled": true 
      }
    }
  ]
}

Monorepo Configuration

For monorepo projects, you typically have a root rule and rules for each package:
{
  "configVersion": "1.6",
  "$schema": "https://github.com/jayu/rev-dep/blob/master/config-schema/1.6.schema.json?raw=true",
  "rules": [
    {
      "path": ".",
      "moduleBoundaries": [
        {
          "name": "packages",
          "pattern": "packages/**/*",
          "allow": ["packages/**/*"]
        }
      ]
    },
    {
      "path": "packages/client",
      "prodEntryPoints": ["src/index.tsx"],
      "circularImportsDetection": { "enabled": true },
      "unusedExportsDetection": { "enabled": true }
    },
    {
      "path": "packages/server",
      "prodEntryPoints": ["src/index.ts"],
      "circularImportsDetection": { "enabled": true },
      "devDepsUsageOnProdDetection": { "enabled": true }
    }
  ]
}
Running rev-dep config init at the workspace root automatically discovers packages and generates this structure.

Supported Config Versions

The CLI supports the following config versions:
  • "1.0", "1.1", "1.2", "1.3", "1.4", "1.5", "1.6"
Using an unsupported configVersion will result in an error. Always update to the latest version for new features.

Validation

The config file is strictly validated on load:
  • Unknown fields are rejected with clear error messages
  • Type mismatches are caught (e.g., string where array expected)
  • Required fields must be present
  • Pattern validation ensures glob patterns don’t start with ./ or ../

Next Steps

Rules Configuration

Learn how to structure rules for different parts of your codebase

Available Checks

Explore all check types and their configuration options

Build docs developers (and LLMs) love