rev-dep 2.9.1 → 2.10.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 +47 -31
- package/package.json +4 -4
package/Readme.md
CHANGED
|
@@ -215,20 +215,20 @@ The configuration file (`rev-dep.config.json(c)` or `.rev-dep.config.json(c)`) a
|
|
|
215
215
|
|
|
216
216
|
```jsonc
|
|
217
217
|
{
|
|
218
|
-
"configVersion": "1.
|
|
219
|
-
"$schema": "https://github.com/jayu/rev-dep/blob/master/config-schema/1.
|
|
218
|
+
"configVersion": "1.6",
|
|
219
|
+
"$schema": "https://github.com/jayu/rev-dep/blob/master/config-schema/1.6.schema.json?raw=true",
|
|
220
220
|
"rules": [
|
|
221
221
|
{
|
|
222
222
|
"path": ".",
|
|
223
|
+
"prodEntryPoints": ["src/main.tsx", "src/pages/**/*.tsx"],
|
|
224
|
+
"devEntryPoints": ["scripts/**", "**/*.test.*"],
|
|
223
225
|
"unusedExportsDetection": {
|
|
224
226
|
"enabled": true,
|
|
225
|
-
"autofix": true
|
|
226
|
-
"validEntryPoints": ["src/index.ts" ]
|
|
227
|
+
"autofix": true
|
|
227
228
|
},
|
|
228
229
|
"orphanFilesDetection": {
|
|
229
230
|
"enabled": true,
|
|
230
|
-
"autofix": true
|
|
231
|
-
"validEntryPoints": ["src/index.ts"]
|
|
231
|
+
"autofix": true
|
|
232
232
|
},
|
|
233
233
|
"unusedNodeModulesDetection": {
|
|
234
234
|
"enabled": true
|
|
@@ -238,7 +238,6 @@ The configuration file (`rev-dep.config.json(c)` or `.rev-dep.config.json(c)`) a
|
|
|
238
238
|
},
|
|
239
239
|
"devDepsUsageOnProdDetection": {
|
|
240
240
|
"enabled": true,
|
|
241
|
-
"prodEntryPoints": ["src/main.tsx", "src/pages/**/*.tsx"],
|
|
242
241
|
"ignoreTypeImports": true
|
|
243
242
|
}
|
|
244
243
|
}
|
|
@@ -252,14 +251,16 @@ Here's a comprehensive example showing all available properties:
|
|
|
252
251
|
|
|
253
252
|
```jsonc
|
|
254
253
|
{
|
|
255
|
-
"configVersion": "1.
|
|
256
|
-
"$schema": "https://github.com/jayu/rev-dep/blob/master/config-schema/1.
|
|
254
|
+
"configVersion": "1.6",
|
|
255
|
+
"$schema": "https://github.com/jayu/rev-dep/blob/master/config-schema/1.6.schema.json?raw=true", // enables json autocompletion
|
|
257
256
|
"conditionNames": ["import", "default"],
|
|
258
257
|
"ignoreFiles": ["**/*.test.*"],
|
|
259
258
|
"rules": [
|
|
260
259
|
{
|
|
261
260
|
"path": ".",
|
|
262
261
|
"followMonorepoPackages": true,
|
|
262
|
+
"prodEntryPoints": ["src/main.tsx", "src/pages/**/*.tsx", "src/server.ts"],
|
|
263
|
+
"devEntryPoints": ["scripts/**", "**/*.test.*"],
|
|
263
264
|
"moduleBoundaries": [
|
|
264
265
|
{
|
|
265
266
|
"name": "ui-components",
|
|
@@ -298,7 +299,6 @@ Here's a comprehensive example showing all available properties:
|
|
|
298
299
|
},
|
|
299
300
|
"orphanFilesDetection": {
|
|
300
301
|
"enabled": true,
|
|
301
|
-
"validEntryPoints": ["src/index.ts", "src/app.ts"],
|
|
302
302
|
"ignoreTypeImports": true,
|
|
303
303
|
"graphExclude": ["**/*.test.*", "**/stories/**/*"],
|
|
304
304
|
"autofix": true
|
|
@@ -320,27 +320,32 @@ Here's a comprehensive example showing all available properties:
|
|
|
320
320
|
},
|
|
321
321
|
"unusedExportsDetection": {
|
|
322
322
|
"enabled": true,
|
|
323
|
-
"
|
|
323
|
+
"autofix": true,
|
|
324
324
|
"ignoreTypeExports": true,
|
|
325
325
|
"graphExclude": ["**/*.stories.tsx"],
|
|
326
|
-
"
|
|
326
|
+
"ignore": {
|
|
327
|
+
"src/types.ts": "B*",
|
|
328
|
+
"**/generated/**/*.ts": "*"
|
|
329
|
+
},
|
|
330
|
+
"ignoreFiles": ["**/*.generated.ts"],
|
|
331
|
+
"ignoreExports": ["default", "unused*"],
|
|
327
332
|
},
|
|
328
333
|
"unresolvedImportsDetection": {
|
|
329
334
|
"enabled": true,
|
|
330
335
|
"ignore": {
|
|
331
|
-
"src/index.ts": "legacy
|
|
336
|
+
"src/index.ts": "legacy-*"
|
|
332
337
|
},
|
|
333
338
|
"ignoreFiles": ["**/*.generated.ts"],
|
|
334
|
-
"ignoreImports": ["@internal
|
|
339
|
+
"ignoreImports": ["@internal/*"]
|
|
335
340
|
},
|
|
336
341
|
"devDepsUsageOnProdDetection": {
|
|
337
342
|
"enabled": true,
|
|
338
|
-
"prodEntryPoints": ["src/main.tsx", "src/pages/**/*.tsx", "src/server.ts"],
|
|
339
343
|
"ignoreTypeImports": true
|
|
340
344
|
},
|
|
341
345
|
"restrictedImportsDetection": {
|
|
342
346
|
"enabled": true,
|
|
343
347
|
"entryPoints": ["src/server.ts", "src/server/**/*.ts"],
|
|
348
|
+
"graphExclude": ["some-file-coupling-other-files.ts"],
|
|
344
349
|
"denyFiles": ["**/*.tsx"],
|
|
345
350
|
"denyModules": ["react", "react-*"],
|
|
346
351
|
"ignoreMatches": ["src/server/allowed-view.tsx", "react-awsome-lib"],
|
|
@@ -364,16 +369,18 @@ Here's a comprehensive example showing all available properties:
|
|
|
364
369
|
Each rule can contain the following properties:
|
|
365
370
|
|
|
366
371
|
- **`path`** (required): Target directory path for this rule (either `.` or path starting with sub directory name)
|
|
367
|
-
- **`followMonorepoPackages`** (optional):
|
|
372
|
+
- **`followMonorepoPackages`** (optional): Control monorepo package resolution. `true` follows all workspace packages (default), `false` disables it, array follows only selected package names.
|
|
373
|
+
- **`prodEntryPoints`** (optional): Rule-level production entry point patterns for detector defaults
|
|
374
|
+
- **`devEntryPoints`** (optional): Rule-level development entry point patterns for detector defaults
|
|
368
375
|
- **`moduleBoundaries`** (optional): Array of module boundary rules
|
|
369
|
-
- **`circularImportsDetection`** (optional): Circular import detection configuration
|
|
370
|
-
- **`orphanFilesDetection`** (optional): Orphan files detection configuration
|
|
371
|
-
- **`unusedNodeModulesDetection`** (optional): Unused node modules detection configuration
|
|
372
|
-
- **`missingNodeModulesDetection`** (optional): Missing node modules detection configuration
|
|
373
|
-
- **`unusedExportsDetection`** (optional): Unused exports detection configuration
|
|
374
|
-
- **`unresolvedImportsDetection`** (optional): Unresolved imports detection configuration
|
|
375
|
-
- **`devDepsUsageOnProdDetection`** (optional): Restricted dev dependencies usage detection configuration
|
|
376
|
-
- **`restrictedImportsDetection`** (optional): Restrict importing denied files/modules from selected entry points
|
|
376
|
+
- **`circularImportsDetection`** (optional): Circular import detection configuration (single object or array of objects)
|
|
377
|
+
- **`orphanFilesDetection`** (optional): Orphan files detection configuration (single object or array of objects)
|
|
378
|
+
- **`unusedNodeModulesDetection`** (optional): Unused node modules detection configuration (single object or array of objects)
|
|
379
|
+
- **`missingNodeModulesDetection`** (optional): Missing node modules detection configuration (single object or array of objects)
|
|
380
|
+
- **`unusedExportsDetection`** (optional): Unused exports detection configuration (single object or array of objects)
|
|
381
|
+
- **`unresolvedImportsDetection`** (optional): Unresolved imports detection configuration (single object or array of objects)
|
|
382
|
+
- **`devDepsUsageOnProdDetection`** (optional): Restricted dev dependencies usage detection configuration (single object or array of objects)
|
|
383
|
+
- **`restrictedImportsDetection`** (optional): Restrict importing denied files/modules from selected entry points (single object or array of objects)
|
|
377
384
|
- **`importConventions`** (optional): Array of import convention rules
|
|
378
385
|
|
|
379
386
|
#### Module Boundary Properties
|
|
@@ -392,13 +399,17 @@ Each rule can contain the following properties:
|
|
|
392
399
|
|
|
393
400
|
#### Detection Options Properties
|
|
394
401
|
|
|
402
|
+
Each detection property can be configured as:
|
|
403
|
+
- a single object (one detector instance), or
|
|
404
|
+
- an array of objects (multiple detector instances evaluated within the same rule).
|
|
405
|
+
|
|
395
406
|
**CircularImportsDetection:**
|
|
396
407
|
- **`enabled`** (required): Enable/disable circular import detection
|
|
397
408
|
- **`ignoreTypeImports`** (optional): Exclude type-only imports when building graph (default: false)
|
|
398
409
|
|
|
399
410
|
**OrphanFilesDetection:**
|
|
400
411
|
- **`enabled`** (required): Enable/disable orphan files detection
|
|
401
|
-
- **`validEntryPoints`** (optional): Array of valid entry point patterns
|
|
412
|
+
- **`validEntryPoints`** (optional): Array of valid entry point patterns. If omitted, defaults to `prodEntryPoints + devEntryPoints` from rule level.
|
|
402
413
|
- **`ignoreTypeImports`** (optional): Exclude type-only imports when building graph (default: false)
|
|
403
414
|
- **`graphExclude`** (optional): File patterns to exclude from graph analysis
|
|
404
415
|
- **`autofix`** (optional): Delete detected orphan files automatically when running `rev-dep config run --fix` (default: false)
|
|
@@ -420,24 +431,29 @@ Each rule can contain the following properties:
|
|
|
420
431
|
|
|
421
432
|
**UnusedExportsDetection:**
|
|
422
433
|
- **`enabled`** (required): Enable/disable unused exports detection
|
|
423
|
-
- **`validEntryPoints`** (optional): Glob patterns for files whose exports are never reported as unused
|
|
434
|
+
- **`validEntryPoints`** (optional): Glob patterns for files whose exports are never reported as unused. If omitted, defaults to `prodEntryPoints + devEntryPoints` from rule level.
|
|
424
435
|
- **`ignoreTypeExports`** (optional): Skip `export type` / `export interface` from analysis (default: false)
|
|
425
436
|
- **`graphExclude`** (optional): File patterns to exclude from unused exports analysis
|
|
437
|
+
- **`ignore`** (optional): Map of file path globs (relative to rule path directory) to export name/specifier glob(s) to suppress; each value can be a string or array of strings
|
|
438
|
+
- **`ignoreFiles`** (optional): File path globs; all unused exports from matching files are suppressed
|
|
439
|
+
- **`ignoreExports`** (optional): Export names/specifiers (or globs) to suppress globally (supports `"default"`)
|
|
440
|
+
- **`autofix`** (optional): Automatically apply fixable unused exports changes when running `rev-dep config run --fix` (default: false)
|
|
426
441
|
|
|
427
442
|
**UnresolvedImportsDetection:**
|
|
428
443
|
- **`enabled`** (required): Enable/disable unresolved imports detection
|
|
429
|
-
- **`ignore`** (optional): Map of file path (relative to rule path directory) to
|
|
444
|
+
- **`ignore`** (optional): Map of file path globs (relative to rule path directory) to import request glob(s) to suppress; each value can be a string or array of strings
|
|
430
445
|
- **`ignoreFiles`** (optional): File path globs; all unresolved imports from matching files are suppressed
|
|
431
|
-
- **`ignoreImports`** (optional): Import requests to suppress globally in unresolved results
|
|
446
|
+
- **`ignoreImports`** (optional): Import requests (or globs) to suppress globally in unresolved results
|
|
432
447
|
|
|
433
|
-
**
|
|
448
|
+
**DevDepsUsageOnProdDetection:**
|
|
434
449
|
- **`enabled`** (required): Enable/disable restricted dev dependencies usage detection
|
|
435
|
-
- **`prodEntryPoints`** (optional): Production entry point patterns to trace dependencies from
|
|
450
|
+
- **`prodEntryPoints`** (optional): Production entry point patterns to trace dependencies from. If omitted, defaults to rule-level `prodEntryPoints`.
|
|
436
451
|
- **`ignoreTypeImports`** (optional): Exclude type-only imports from graph traversal and module matching (default: false)
|
|
437
452
|
|
|
438
453
|
**RestrictedImportsDetection:**
|
|
439
454
|
- **`enabled`** (required): Enable/disable restricted imports detection
|
|
440
|
-
- **`entryPoints`** (required when enabled): Entry point patterns used to build reachable dependency graph
|
|
455
|
+
- **`entryPoints`** (required when enabled): Entry point patterns used to build reachable dependency graph (rule-level entry points are not applied here)
|
|
456
|
+
- **`graphExclude`** (optional): File patterns to exclude from restricted imports graph analysis
|
|
441
457
|
- **`denyFiles`** (optional): Denied file path patterns (eg. ["**/*.tsx"])
|
|
442
458
|
- **`denyModules`** (optional): Denied module patterns (eg. ["react", "react-*"])
|
|
443
459
|
- **`ignoreMatches`** (optional): File/module patterns to suppress from restricted import results
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rev-dep",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.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.10.0",
|
|
21
|
+
"@rev-dep/linux-x64": "2.10.0",
|
|
22
|
+
"@rev-dep/win32-x64": "2.10.0"
|
|
23
23
|
},
|
|
24
24
|
"keywords": [
|
|
25
25
|
"dependency-analysis",
|