Overview
Rev-dep provides 10 different check types to enforce codebase quality and architectural constraints. Each check can be enabled per-rule and configured with specific options.
Most checks support both single object and array of objects formats, allowing multiple detector instances with different configurations.
moduleBoundaries
Enforce architecture boundaries between modules. Prevent unauthorized cross-domain imports based on file patterns.
Array of boundary rule objects. Show Boundary Rule Properties
Name of the boundary for identification in error messages.
Glob pattern for files in this boundary.
Glob patterns for allowed imports. Files matching these patterns can be imported.
Glob patterns for denied imports. Overrides allow patterns.
Basic Example
Layered Architecture
{
"moduleBoundaries" : [
{
"name" : "ui-components" ,
"pattern" : "src/components/**/*" ,
"allow" : [ "src/utils/**/*" , "src/types/**/*" ],
"deny" : [ "src/api/**/*" ]
},
{
"name" : "api-layer" ,
"pattern" : "src/api/**/*" ,
"allow" : [ "src/utils/**/*" , "src/types/**/*" ],
"deny" : [ "src/components/**/*" ]
}
]
}
How it works: Files matching pattern are checked against allow and deny rules. Imports not matching allow (or matching deny) trigger violations.
importConventions
Enforce import style conventions (relative vs absolute). Automatically fix violations.
Array of import convention rules. Show Import Convention Properties
Convention type. Currently only "relative-internal-absolute-external" is supported. This enforces:
Internal imports (within same domain): relative paths
External imports (from other domains): absolute paths using aliases
Automatically fix import convention violations when running with --fix flag.
Array of domain definitions. Can be strings (glob patterns) or objects. Domain Object:
path (required): Directory with domain files
alias (optional): Alias for absolute imports from this domain
enabled (optional): Set to false to skip checks for this domain (default: true)
Feature Domains
With Disabled Domain
{
"importConventions" : [
{
"rule" : "relative-internal-absolute-external" ,
"autofix" : true ,
"domains" : [
{
"path" : "src/features/auth" ,
"alias" : "@auth" ,
"enabled" : true
},
{
"path" : "src/features/dashboard" ,
"alias" : "@dashboard" ,
"enabled" : true
},
{
"path" : "src/shared" ,
"alias" : "@shared" ,
"enabled" : true
}
]
}
]
}
Violation Examples:
// ❌ Bad: relative import to external domain
// File: src/features/auth/login.ts
import { Button } from '../../../shared/ui/Button'
// ✅ Good: absolute import with alias
import { Button } from '@shared/ui/Button'
// ✅ Good: relative import within same domain
import { validateEmail } from './validators'
circularImportsDetection
Detect circular import chains in your codebase.
Circular imports detection configuration. Enable/disable circular import detection.
Exclude type-only imports when building the dependency graph. Useful for TypeScript projects where type imports don’t cause runtime circular dependencies.
{
"circularImportsDetection" : {
"enabled" : true ,
"ignoreTypeImports" : true
}
}
Set ignoreTypeImports: true for TypeScript projects to avoid false positives from type-only circular references.
orphanFilesDetection
Detect dead/orphan files unreachable from entry points. Supports autofix (deletes files).
Orphan files detection configuration. Enable/disable orphan files detection.
Entry point glob patterns. Files not reachable from these are considered orphans. If omitted, defaults to prodEntryPoints + devEntryPoints from rule level.
Exclude type-only imports when building the dependency graph.
File patterns to exclude from graph analysis. These files are ignored when tracing dependencies.
Dangerous: Automatically delete orphan files when running with --fix flag.
{
"orphanFilesDetection" : {
"enabled" : true ,
"validEntryPoints" : [ "src/main.tsx" , "src/pages/**/*.tsx" ],
"ignoreTypeImports" : true ,
"graphExclude" : [ "**/*.test.*" , "**/stories/**/*" ],
"autofix" : true
}
}
Be careful with autofix: true - it will permanently delete orphan files. Always run without --fix first to review.
unusedExportsDetection
Detect exports that are never imported. Supports autofix (removes exports).
Unused exports detection configuration. Enable/disable unused exports detection.
Glob patterns for files whose exports are never reported as unused. If omitted, defaults to prodEntryPoints + devEntryPoints from rule level.
Skip export type / export interface from analysis.
File patterns to exclude from unused exports analysis.
Map of file path globs to export name/specifier globs to suppress. Each value can be a string or array of strings. {
"src/types.ts" : "B*" ,
"**/generated/**/*.ts" : "*"
}
File path globs. All unused exports from matching files are suppressed.
Export names/specifiers (or globs) to suppress globally. Supports "default" to ignore all default exports.
Automatically remove unused exports when running with --fix flag.
{
"unusedExportsDetection" : {
"enabled" : true ,
"autofix" : true ,
"ignoreTypeExports" : true ,
"graphExclude" : [ "**/*.stories.tsx" ],
"ignore" : {
"src/types.ts" : "B*" ,
"**/generated/**/*.ts" : "*"
},
"ignoreFiles" : [ "**/*.generated.ts" ],
"ignoreExports" : [ "default" , "unused*" ]
}
}
unusedNodeModulesDetection
Detect dependencies declared in package.json but not used in code.
unusedNodeModulesDetection
Unused node modules detection configuration. Enable/disable unused modules detection.
Module patterns to include in analysis (e.g., ["@myorg/**"]).
Module patterns to exclude from analysis (e.g., ["@types/**"]).
pkgJsonFieldsWithBinaries
Package.json fields containing binary references (e.g., ["scripts", "bin"]). Performs plain-text lookup to detect binary usage.
File patterns to search for binary usage (e.g., ["scripts/**"]). Performs plain-text lookup.
Non-JS/TS file patterns to search for module imports (e.g., [".storybook/main.ts"]). Performs plain-text lookup.
Output format: "list", "groupByModule", or "groupByFile".
{
"unusedNodeModulesDetection" : {
"enabled" : true ,
"includeModules" : [ "@myorg/**" ],
"excludeModules" : [ "@types/**" ],
"pkgJsonFieldsWithBinaries" : [ "scripts" , "bin" ],
"filesWithBinaries" : [ "scripts/check-something.sh" ],
"filesWithModules" : [ ".storybook/main.ts" ],
"outputType" : "groupByModule"
}
}
missingNodeModulesDetection
Detect imports that are not declared in package.json dependencies.
missingNodeModulesDetection
Missing node modules detection configuration. Enable/disable missing modules detection.
Module patterns to include in analysis.
Module patterns to exclude from analysis.
Output format: "list", "groupByModule", "groupByFile", or "groupByModuleFilesCount".
{
"missingNodeModulesDetection" : {
"enabled" : true ,
"includeModules" : [ "lodash" , "axios" ],
"excludeModules" : [ "@types/**" ],
"outputType" : "groupByFile"
}
}
unresolvedImportsDetection
Detect import requests that cannot be resolved during module resolution.
unresolvedImportsDetection
Unresolved imports detection configuration. Enable/disable unresolved imports detection.
Map of file path globs to import request glob(s) to suppress. Each value can be a string or array of strings.
File path globs. All unresolved imports from matching files are suppressed.
Import requests (or globs) to suppress globally.
{
"unresolvedImportsDetection" : {
"enabled" : true ,
"ignore" : {
"src/index.ts" : "legacy-*"
},
"ignoreFiles" : [ "**/*.generated.ts" ],
"ignoreImports" : [ "@internal/*" ]
}
}
devDepsUsageOnProdDetection
Detect dev dependencies imported in production code.
devDepsUsageOnProdDetection
Dev dependencies usage detection configuration. Enable/disable dev dependencies usage detection.
Production entry points to trace from. If omitted, defaults to rule-level prodEntryPoints.
Exclude type-only imports from graph traversal and module matching.
{
"devDepsUsageOnProdDetection" : {
"enabled" : true ,
"ignoreTypeImports" : true
}
}
Example output:
❌ Restricted Dev Dependencies Usage Issues (2):
lodash (dev dependency)
- src/components/Button.tsx (from entry point: src/pages/index.tsx)
- src/utils/helpers.ts (from entry point: src/pages/index.tsx)
Enable ignoreTypeImports: true to allow importing types from dev dependencies (safe at runtime).
restrictedImportsDetection
Block importing denied files/modules from selected entry points.
restrictedImportsDetection
Restricted imports detection configuration. Enable/disable restricted imports detection.
Entry point patterns used to build reachable dependency graph. Rule-level entry points are not applied here - must be explicitly specified.
File patterns to exclude from graph analysis.
Denied file path patterns (e.g., ["**/*.tsx"]).
Denied module patterns (e.g., ["react", "react-*"]).
File/module patterns to suppress from results.
Exclude type-only imports from traversal.
{
"restrictedImportsDetection" : {
"enabled" : true ,
"entryPoints" : [ "src/server.ts" , "src/server/**/*.ts" ],
"graphExclude" : [ "some-file-coupling-other-files.ts" ],
"denyFiles" : [ "**/*.tsx" ],
"denyModules" : [ "react" , "react-*" ],
"ignoreMatches" : [ "src/server/allowed-view.tsx" , "react-awesome-lib" ],
"ignoreTypeImports" : true
}
}
Use case: Prevent server code from importing browser-only libraries (React, DOM APIs, etc.).
Multiple Detector Instances
Most checks support arrays to run multiple detector instances with different configurations:
{
"orphanFilesDetection" : [
{
"enabled" : true ,
"validEntryPoints" : [ "src/main.tsx" ],
"graphExclude" : [ "**/*.test.*" ]
},
{
"enabled" : true ,
"validEntryPoints" : [ "scripts/build.ts" ],
"graphExclude" : [ "src/**/*" ]
}
]
}
Next Steps
Rules Learn how to structure rules
Config File Complete config schema reference
CLI: config run Command-line options
Monorepo Guide Monorepo-specific configuration