rev-dep 2.4.0 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Readme.md +45 -2
- package/package.json +4 -4
package/Readme.md
CHANGED
|
@@ -303,6 +303,7 @@ Rev-dep provides a configuration system for orchestrating project checks. The co
|
|
|
303
303
|
Available checks are:
|
|
304
304
|
|
|
305
305
|
- **module boundaries** - check if imports respect module boundaries
|
|
306
|
+
- **import conventions** - enforce syntactic consistency for imports (includes autofix capability)
|
|
306
307
|
- **circular imports** - check if there are circular imports
|
|
307
308
|
- **orphan files** - check if there are orphan/dead files
|
|
308
309
|
- **unused node modules** - check against unused node modules
|
|
@@ -331,6 +332,19 @@ Run all configured checks:
|
|
|
331
332
|
rev-dep config run
|
|
332
333
|
```
|
|
333
334
|
|
|
335
|
+
List all detected issues:
|
|
336
|
+
```bash
|
|
337
|
+
# Lists all detected issues, by default lists first five issues for each check
|
|
338
|
+
rev-dep config run --list-all-issues
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
Fix all fixable checks:
|
|
342
|
+
|
|
343
|
+
```bash
|
|
344
|
+
# Fix checks configured with autofix
|
|
345
|
+
rev-dep config run --fix
|
|
346
|
+
```
|
|
347
|
+
|
|
334
348
|
### Configuration Structure
|
|
335
349
|
|
|
336
350
|
The configuration file (`rev-dep.config.json(c)` or `.rev-dep.config.json(c)`) allows you to define multiple rules, each targeting different parts of your codebase with specific checks enabled.
|
|
@@ -339,8 +353,8 @@ Here's a comprehensive example showing all available properties:
|
|
|
339
353
|
|
|
340
354
|
```jsonc
|
|
341
355
|
{
|
|
342
|
-
"configVersion": "1.
|
|
343
|
-
"$schema": "https://github.com/jayu/rev-dep/blob/
|
|
356
|
+
"configVersion": "1.2",
|
|
357
|
+
"$schema": "https://github.com/jayu/rev-dep/blob/master/config-schema/1.2.schema.json?raw=true", // enables json autocompletion
|
|
344
358
|
"conditionNames": ["import", "default"],
|
|
345
359
|
"ignoreFiles": ["**/*.test.*"],
|
|
346
360
|
"rules": [
|
|
@@ -361,6 +375,24 @@ Here's a comprehensive example showing all available properties:
|
|
|
361
375
|
"deny": ["src/components/**/*"]
|
|
362
376
|
}
|
|
363
377
|
],
|
|
378
|
+
"importConventions": [
|
|
379
|
+
{
|
|
380
|
+
"rule": "relative-internal-absolute-external",
|
|
381
|
+
"autofix": true,
|
|
382
|
+
"domains": [
|
|
383
|
+
{
|
|
384
|
+
"path": "src/features/auth",
|
|
385
|
+
"alias": "@auth",
|
|
386
|
+
"enabled": true
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
"path": "src/shared/ui",
|
|
390
|
+
"alias": "@ui-kit",
|
|
391
|
+
"enabled": false // checks disabled for this domain, but alias is still used for absolute imports from other domains
|
|
392
|
+
}
|
|
393
|
+
]
|
|
394
|
+
}
|
|
395
|
+
],
|
|
364
396
|
"circularImportsDetection": {
|
|
365
397
|
"enabled": true,
|
|
366
398
|
"ignoreTypeImports": true
|
|
@@ -410,6 +442,7 @@ Each rule can contain the following properties:
|
|
|
410
442
|
- **`orphanFilesDetection`** (optional): Orphan files detection configuration
|
|
411
443
|
- **`unusedNodeModulesDetection`** (optional): Unused node modules detection configuration
|
|
412
444
|
- **`missingNodeModulesDetection`** (optional): Missing node modules detection configuration
|
|
445
|
+
- **`importConventions`** (optional): Array of import convention rules
|
|
413
446
|
|
|
414
447
|
#### Module Boundary Properties
|
|
415
448
|
- **`name`** (required): Name of the boundary
|
|
@@ -417,6 +450,14 @@ Each rule can contain the following properties:
|
|
|
417
450
|
- **`allow`** (optional): Array of allowed import patterns
|
|
418
451
|
- **`deny`** (optional): Array of denied import patterns (overrides allow)
|
|
419
452
|
|
|
453
|
+
#### Import Convention Properties
|
|
454
|
+
- **`rule`** (required): Type of the rule, currently only `relative-internal-absolute-external`
|
|
455
|
+
- **`autofix`** (optional): Whether to automatically fix import convention violations (default: false)
|
|
456
|
+
- **`domains`** (required): Array of domain definitions. Can be a string (glob pattern) or an object with:
|
|
457
|
+
- **`path`** (required): Directory with the domain files
|
|
458
|
+
- **`alias`** (optional): Alias to be used for absolute imports of code from this domain
|
|
459
|
+
- **`enabled`** (optional): Set to `false` to skip checks for this domain (default: true)
|
|
460
|
+
|
|
420
461
|
#### Detection Options Properties
|
|
421
462
|
|
|
422
463
|
**CircularImportsDetection:**
|
|
@@ -612,8 +653,10 @@ rev-dep config run [flags]
|
|
|
612
653
|
```
|
|
613
654
|
--condition-names strings List of conditions for package.json imports resolution (e.g. node, imports, default)
|
|
614
655
|
-c, --cwd string Working directory (default "$PWD")
|
|
656
|
+
--fix Automatically fix fixable issues
|
|
615
657
|
--follow-monorepo-packages Enable resolution of imports from monorepo workspace packages
|
|
616
658
|
-h, --help help for run
|
|
659
|
+
--list-all-issues List all issues instead of limiting output
|
|
617
660
|
--package-json string Path to package.json (default: ./package.json)
|
|
618
661
|
--tsconfig-json string Path to tsconfig.json (default: ./tsconfig.json)
|
|
619
662
|
-v, --verbose Show warnings and verbose output
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rev-dep",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"description": "Trace imports, detect unused code, clean dependencies — all with a super-fast CLI",
|
|
5
5
|
"bin": "bin.js",
|
|
6
6
|
"files": [
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"node": ">=18"
|
|
18
18
|
},
|
|
19
19
|
"optionalDependencies": {
|
|
20
|
-
"@rev-dep/darwin-arm64": "2.
|
|
21
|
-
"@rev-dep/linux-x64": "2.
|
|
22
|
-
"@rev-dep/win32-x64": "2.
|
|
20
|
+
"@rev-dep/darwin-arm64": "2.6.0",
|
|
21
|
+
"@rev-dep/linux-x64": "2.6.0",
|
|
22
|
+
"@rev-dep/win32-x64": "2.6.0"
|
|
23
23
|
},
|
|
24
24
|
"keywords": [
|
|
25
25
|
"dependency-analysis",
|