dependency-cruiser 16.6.0 → 16.7.0-beta-2

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.
Files changed (71) hide show
  1. package/bin/depcruise-baseline.mjs +1 -1
  2. package/package.json +6 -6
  3. package/src/cache/cache.mjs +3 -4
  4. package/src/cache/content-strategy.mjs +5 -7
  5. package/src/cache/find-content-changes.mjs +11 -5
  6. package/src/cache/helpers.mjs +8 -8
  7. package/src/cache/metadata-strategy.mjs +6 -8
  8. package/src/cache/options-compatible.mjs +2 -1
  9. package/src/cli/index.mjs +4 -2
  10. package/src/cli/init-config/build-config.mjs +13 -9
  11. package/src/cli/init-config/config-template.mjs +11 -0
  12. package/src/cli/init-config/index.mjs +10 -6
  13. package/src/cli/init-config/normalize-init-options.mjs +10 -6
  14. package/src/cli/listeners/performance-log/format-helpers.mjs +1 -1
  15. package/src/cli/normalize-cli-options.mjs +1 -0
  16. package/src/cli/utl/io.mjs +1 -2
  17. package/src/config-utl/extract-babel-config.mjs +0 -1
  18. package/src/config-utl/extract-depcruise-options.mjs +8 -4
  19. package/src/config-utl/extract-known-violations.mjs +6 -6
  20. package/src/config-utl/extract-webpack-resolve-config.mjs +1 -1
  21. package/src/enrich/soften-known-violations.mjs +1 -1
  22. package/src/enrich/summarize/add-rule-set-used.mjs +1 -0
  23. package/src/enrich/summarize/summarize-modules.mjs +0 -1
  24. package/src/enrich/summarize/summarize-options.mjs +2 -0
  25. package/src/extract/extract-dependencies.mjs +16 -11
  26. package/src/extract/extract-stats.mjs +9 -4
  27. package/src/extract/gather-initial-sources.mjs +8 -5
  28. package/src/extract/index.mjs +9 -4
  29. package/src/extract/resolve/determine-dependency-types.mjs +22 -15
  30. package/src/extract/resolve/external-module-helpers.mjs +4 -4
  31. package/src/extract/resolve/index.mjs +11 -5
  32. package/src/extract/resolve/module-classifiers.mjs +9 -4
  33. package/src/extract/resolve/resolve-helpers.mjs +3 -3
  34. package/src/extract/swc/dependency-visitor.mjs +2 -6
  35. package/src/extract/swc/parse.mjs +8 -4
  36. package/src/extract/tsc/extract-typescript-deps.mjs +121 -16
  37. package/src/extract/tsc/extract.mjs +2 -1
  38. package/src/graph-utl/consolidate-module-dependencies.mjs +8 -4
  39. package/src/graph-utl/filter-bank.mjs +8 -4
  40. package/src/graph-utl/indexed-module-graph.mjs +7 -11
  41. package/src/graph-utl/rule-set.mjs +9 -5
  42. package/src/main/cruise.mjs +2 -2
  43. package/src/main/format.mjs +0 -1
  44. package/src/main/options/assert-validity.mjs +13 -9
  45. package/src/main/options/defaults.mjs +1 -0
  46. package/src/main/options/normalize.mjs +23 -13
  47. package/src/main/report-wrap.mjs +12 -7
  48. package/src/main/resolve-options/normalize.mjs +10 -5
  49. package/src/main/rule-set/assert-validity.mjs +5 -2
  50. package/src/main/rule-set/normalize.mjs +21 -11
  51. package/src/meta.cjs +1 -1
  52. package/src/report/anon/anonymize-path.mjs +1 -1
  53. package/src/report/d2.mjs +2 -2
  54. package/src/report/dot/index.mjs +3 -3
  55. package/src/report/dot-webpage/svg-in-html-snippets/script.cjs +4 -4
  56. package/src/report/markdown.mjs +41 -30
  57. package/src/report/mermaid.mjs +2 -2
  58. package/src/report/teamcity.mjs +1 -0
  59. package/src/schema/baseline-violations.schema.mjs +1 -1
  60. package/src/schema/configuration.schema.mjs +1 -1
  61. package/src/schema/cruise-result.schema.mjs +1 -1
  62. package/src/utl/get-extension.mjs +1 -1
  63. package/src/utl/try-import.mjs +0 -1
  64. package/src/utl/try-require.cjs +2 -2
  65. package/src/validate/index.mjs +6 -2
  66. package/src/validate/match-dependency-rule.mjs +8 -4
  67. package/src/validate/match-module-rule-helpers.mjs +16 -10
  68. package/src/validate/match-module-rule.mjs +8 -5
  69. package/src/validate/matchers.mjs +1 -3
  70. package/types/options.d.mts +5 -0
  71. package/types/shared-types.d.mts +3 -0
@@ -28,7 +28,7 @@ try {
28
28
  .arguments("<files-or-directories>")
29
29
  .parse(process.argv);
30
30
 
31
- if (Boolean(program.args[0])) {
31
+ if (program.args[0]) {
32
32
  process.exitCode = await cli(program.args, {
33
33
  ...program.opts(),
34
34
  cache: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dependency-cruiser",
3
- "version": "16.6.0",
3
+ "version": "16.7.0-beta-2",
4
4
  "description": "Validate and visualize dependencies. With your rules. JavaScript, TypeScript, CoffeeScript. ES6, CommonJS, AMD.",
5
5
  "keywords": [
6
6
  "static analysis",
@@ -159,19 +159,19 @@
159
159
  "safe-regex": "^2.1.1",
160
160
  "semver": "^7.6.3",
161
161
  "teamcity-service-messages": "^0.1.14",
162
- "tsconfig-paths-webpack-plugin": "^4.1.0",
163
- "watskeburt": "^4.1.0"
162
+ "tsconfig-paths-webpack-plugin": "^4.2.0",
163
+ "watskeburt": "^4.1.1"
164
164
  },
165
165
  "overrides": {
166
- "semver": "^7.6.3"
166
+ "cross-spawn": ">=6.0.6"
167
167
  },
168
168
  "resolutions": {
169
- "semver": "^7.6.3"
169
+ "cross-spawn": ">=6.0.6"
170
170
  },
171
171
  "engines": {
172
172
  "node": "^18.17||>=20"
173
173
  },
174
174
  "scripts": {
175
- "test": "echo for test, build and static analysis scripts: see the github repository"
175
+ "test": "echo see github for test, build and analysis scripts"
176
176
  }
177
177
  }
@@ -13,10 +13,9 @@ import { scannableExtensions } from "#extract/transpile/meta.mjs";
13
13
  import { bus } from "#utl/bus.mjs";
14
14
 
15
15
  /**
16
- * @typedef {import("../../types/dependency-cruiser.mjs").IRevisionData} IRevisionData
17
- * @typedef {import("../../types/strict-options.mjs").IStrictCruiseOptions} IStrictCruiseOptions
18
- * @typedef {import("../../types/dependency-cruiser.mjs").ICruiseResult} ICruiseResult
19
- * @typedef {import("../../types/cache-options.mjs").cacheStrategyType} cacheStrategyType
16
+ * @import { IRevisionData, ICruiseResult } from "../../types/dependency-cruiser.mjs";
17
+ * @import { IStrictCruiseOptions } from "../../types/strict-options.mjs";
18
+ * @import { cacheStrategyType } from "../../types/cache-options.mjs";
20
19
  */
21
20
 
22
21
  const CACHE_FILE_NAME = "cache.json";
@@ -10,11 +10,9 @@ import {
10
10
  } from "./helpers.mjs";
11
11
 
12
12
  /**
13
- * @typedef {import("../../types/dependency-cruiser.mjs").IModule} IModule
14
- * @typedef {import("../../types/dependency-cruiser.mjs").IRevisionChange} IRevisionChange
15
- * @typedef {import("../../types/dependency-cruiser.mjs").IRevisionData} IRevisionData
16
- * @typedef {import("../../types/dependency-cruiser.mjs").ICruiseResult} ICruiseResult
17
- * @typedef {import("../../types/strict-options.mjs").IStrictCruiseOptions} IStrictCruiseOptions
13
+ * @import { IModule, IRevisionChange, IRevisionData, ICruiseResult } from "../../types/dependency-cruiser.mjs"
14
+ * @import { IStrictCruiseOptions } from "../../types/strict-options.mjs"
15
+ * @import { changeType, getSHA } from "watskeburt"
18
16
  */
19
17
 
20
18
  /**
@@ -56,10 +54,10 @@ export default class ContentStrategy {
56
54
  * @param {IStrictCruiseOptions} pCruiseOptions
57
55
  * @param {Object} pOptions
58
56
  * @param {Set<string>} pOptions.extensions
59
- * @param {Set<import("watskeburt").changeType>=} pOptions.interestingChangeTypes?
57
+ * @param {Set<changeType>=} pOptions.interestingChangeTypes?
60
58
  * @param {string=} pOptions.baseDir
61
59
  * @param {typeof findContentChanges=} pOptions.diffListFn
62
- * @param {typeof import('watskeburt').getSHA=} pOptions.checksumFn
60
+ * @param {typeof getSHA=} pOptions.checksumFn
63
61
  * @returns {IRevisionData}
64
62
  */
65
63
  getRevisionData(pDirectory, pCachedCruiseResult, pCruiseOptions, pOptions) {
@@ -11,10 +11,16 @@ import {
11
11
  import { bus } from "#utl/bus.mjs";
12
12
  import findAllFiles from "#utl/find-all-files.mjs";
13
13
 
14
+ /**
15
+ * @import { IModule, IRevisionChange } from "../../types/dependency-cruiser.mjs"
16
+ * @import { ICruiseResult } from "../../types/cruise-result.mjs"
17
+ * @import { IStrictExcludeType, IStrictIncludeOnlyType } from "../../types/strict-filter-types.mjs"
18
+ */
19
+
14
20
  /**
15
21
  * @param {Set<string>} pFileSet
16
22
  * @param {typeof getFileHashSync} pFileHashFunction
17
- * @returns {(pModule:import("../..").IModule) => import('../..').IRevisionChange}
23
+ * @returns {(pModule:IModule) => IRevisionChange}
18
24
  */
19
25
  function diffCachedModuleAgainstFileSet(
20
26
  pFileSet,
@@ -63,13 +69,13 @@ function diffCachedModuleAgainstFileSet(
63
69
  - there is a cache, but it doesn't contain checksums => same as before, except
64
70
  all files will be marked as 'modified'
65
71
  * @param {string} pDirectory
66
- * @param {import("../..").ICruiseResult} pCachedCruiseResult
72
+ * @param {ICruiseResult} pCachedCruiseResult
67
73
  * @param {Object} pOptions
68
74
  * @param {Set<string>} pOptions.extensions
69
75
  * @param {string} pOptions.baseDir
70
- * @param {import("../../types/strict-filter-types.mjs").IStrictExcludeType} pOptions.exclude
71
- * @param {import("../../types/strict-filter-types.mjs").IStrictIncludeOnlyType=} pOptions.includeOnly
72
- * @returns {import("../..").IRevisionChange[]}
76
+ * @param {IStrictExcludeType} pOptions.exclude
77
+ * @param {IStrictIncludeOnlyType=} pOptions.includeOnly
78
+ * @returns {IRevisionChange[]}
73
79
  */
74
80
  export default function findContentChanges(
75
81
  pDirectory,
@@ -6,10 +6,10 @@ import memoize from "memoize";
6
6
  import { filenameMatchesPattern } from "#graph-utl/match-facade.mjs";
7
7
 
8
8
  /**
9
- * @typedef {import("../..").IModule} IModule
10
- * @typedef {import("../../types/dependency-cruiser.mjs").IRevisionChange} IRevisionChange
11
- * @typedef {import("../../types/filter-types.mjs").IExcludeType} IExcludeType
12
- * @typedef {import("../../types/strict-filter-types.mjs").IStrictIncludeOnlyType} IStrictIncludeOnlyType
9
+ * @import { IModule, IRevisionChange, } from "../../types/dependency-cruiser.mjs"
10
+ * @import { IExcludeType } from "../../types/filter-types.mjs"
11
+ * @import { IStrictIncludeOnlyType } from "../../types/strict-filter-types.mjs"
12
+ * @import { changeType, IChange } from "watskeburt"
13
13
  */
14
14
 
15
15
  /**
@@ -35,7 +35,7 @@ function _getFileHashSync(pFileName) {
35
35
  export const getFileHashSync = memoize(_getFileHashSync);
36
36
 
37
37
  /**
38
- * @param {import("watskeburt").IChange} pChange
38
+ * @param {IChange} pChange
39
39
  * @return {IRevisionChange}
40
40
  */
41
41
  export function addCheckSumToChangeSync(pChange) {
@@ -80,7 +80,7 @@ export function hasInterestingExtension(pExtensions) {
80
80
 
81
81
  /**
82
82
  * @param {Set<string>} pExtensions
83
- * @returns {(pChange: import("watskeburt").IChange) => boolean}
83
+ * @returns {(pChange: IChange) => boolean}
84
84
  */
85
85
  export function changeHasInterestingExtension(pExtensions) {
86
86
  return (pChange) => {
@@ -106,8 +106,8 @@ const DEFAULT_INTERESTING_CHANGE_TYPES = new Set([
106
106
  ]);
107
107
 
108
108
  /**
109
- * @param {Set<import("watskeburt").changeType>=} pInterestingChangeTypes
110
- * @returns {(pChange: import("watskeburt").IChange) => boolean}
109
+ * @param {Set<changeType>=} pInterestingChangeTypes
110
+ * @returns {(pChange: IChange) => boolean}
111
111
  */
112
112
  export function isInterestingChangeType(pInterestingChangeTypes) {
113
113
  return (pChange) =>
@@ -12,20 +12,18 @@ import {
12
12
  import { bus } from "#utl/bus.mjs";
13
13
 
14
14
  /**
15
- * @typedef {import("../../types/dependency-cruiser.mjs").IModule} IModule
16
- * @typedef {import("../../types/dependency-cruiser.mjs").IRevisionChange} IRevisionChange
17
- * @typedef {import("../../types/dependency-cruiser.mjs").IRevisionData} IRevisionData
18
- * @typedef {import("../../types/dependency-cruiser.mjs").ICruiseResult} ICruiseResult
19
- * @typedef {import("../../types/strict-options.mjs").IStrictCruiseOptions} IStrictCruiseOptions
15
+ * @import {IModule, IRevisionChange, IRevisionData, ICruiseResult } from "../../types/dependency-cruiser.mjs"
16
+ * @import { IStrictCruiseOptions } from "../../types/strict-options.mjs"
17
+ * @import { changeType, IChange } from "watskeburt"
20
18
  */
21
19
 
22
20
  export default class MetaDataStrategy {
23
21
  /**
24
22
  * @param {string} _pDirectory
25
- * @param {import("../../types/cruise-result.mjs").ICruiseResult} _pCachedCruiseResult
23
+ * @param {ICruiseResult} _pCachedCruiseResult
26
24
  * @param {Object} pOptions
27
25
  * @param {Set<string>} pOptions.extensions
28
- * @param {Set<import("watskeburt").changeType>=} pOptions.interestingChangeTypes
26
+ * @param {Set<changeType>=} pOptions.interestingChangeTypes
29
27
  * @param {typeof getSHA=} pOptions.shaRetrievalFn
30
28
  * @param {typeof list=} pOptions.diffListFn
31
29
  * @param {typeof addCheckSumToChangeSync=} pOptions.checksumFn
@@ -47,7 +45,7 @@ export default class MetaDataStrategy {
47
45
  bus.debug("cache: - getting sha");
48
46
  const lSHA = await lOptions.shaRetrievalFn();
49
47
  bus.debug("cache: - getting diff");
50
- const lDiff = /** @type {import("watskeburt").IChange[]} */ (
48
+ const lDiff = /** @type {IChange[]} */ (
51
49
  await lOptions.diffListFn({ oldRevision: lSHA })
52
50
  );
53
51
  const lChanges = lDiff
@@ -2,7 +2,7 @@
2
2
  import { isDeepStrictEqual } from "node:util";
3
3
 
4
4
  /**
5
- * @typedef {import("../../types/strict-options.mjs").IStrictCruiseOptions} IStrictCruiseOptions
5
+ * @import { IStrictCruiseOptions } from "../../types/strict-options.mjs"
6
6
  */
7
7
 
8
8
  /*
@@ -105,6 +105,7 @@ export function optionsAreCompatible(pOldOptions, pNewOptions) {
105
105
  pOldOptions.preserveSymlinks === pNewOptions.preserveSymlinks &&
106
106
  pOldOptions.combinedDependencies === pNewOptions.combinedDependencies &&
107
107
  pOldOptions.experimentalStats === pNewOptions.experimentalStats &&
108
+ pOldOptions.detectJSDocImports === pNewOptions.detectJSDocImports &&
108
109
  metricsIsCompatible(pOldOptions.metrics, pNewOptions.metrics) &&
109
110
  // includeOnly suffers from a backwards compatibility disease
110
111
  includeOnlyIsCompatible(pOldOptions.includeOnly, pNewOptions.includeOnly) &&
package/src/cli/index.mjs CHANGED
@@ -13,6 +13,7 @@ import { set } from "#utl/object-util.mjs";
13
13
  import cruise from "#main/cruise.mjs";
14
14
  import { INFO, bus } from "#utl/bus.mjs";
15
15
 
16
+ // eslint-disable-next-line complexity
16
17
  async function extractResolveOptions(pCruiseOptions) {
17
18
  let lResolveOptions = {};
18
19
  const lWebPackConfigFileName =
@@ -78,6 +79,7 @@ async function extractBabelConfigOptions(pCruiseOptions) {
78
79
  return lReturnValue;
79
80
  }
80
81
 
82
+ // eslint-disable-next-line complexity
81
83
  function setUpListener(pCruiseOptions) {
82
84
  const lString2Listener = new Map([
83
85
  ["cli-feedback", setUpCliFeedbackListener],
@@ -90,7 +92,7 @@ function setUpListener(pCruiseOptions) {
90
92
 
91
93
  const lListenerFunction = lString2Listener.get(lListenerID);
92
94
  /* c8 ignore next 6 */
93
- if (Boolean(lListenerFunction)) {
95
+ if (lListenerFunction) {
94
96
  lListenerFunction(
95
97
  bus,
96
98
  pCruiseOptions?.ruleSet?.options?.progress?.maximumLevel ?? INFO,
@@ -141,7 +143,7 @@ async function runCruise(pFileDirectoryArray, pCruiseOptions) {
141
143
  * @param {{stdout: NodeJS.WritableStream, stderr: NodeJS.WritableStream}=} pStreams
142
144
  * @returns {number}
143
145
  */
144
- // eslint-disable-next-line complexity
146
+
145
147
  export default async function executeCli(
146
148
  pFileDirectoryArray,
147
149
  pCruiseOptions,
@@ -2,6 +2,10 @@
2
2
  import { folderNameArrayToRE } from "./utl.mjs";
3
3
  import configTemplate from "./config-template.mjs";
4
4
 
5
+ /**
6
+ * @import { IInitConfig } from "./types.js";
7
+ */
8
+
5
9
  /**
6
10
  * @param {string} pString
7
11
  * @returns {string}
@@ -22,7 +26,7 @@ function extensionsToString(pExtensions) {
22
26
  }
23
27
 
24
28
  /**
25
- * @param {import("./types.js").IInitConfig} pInitOptions
29
+ * @param {IInitConfig} pInitOptions
26
30
  * @returns {string}
27
31
  */
28
32
  function buildNotToTestRule(pInitOptions) {
@@ -49,7 +53,7 @@ function buildNotToTestRule(pInitOptions) {
49
53
  }
50
54
 
51
55
  /**
52
- * @param {import("./types.js").IInitConfig} pInitOptions
56
+ * @param {IInitConfig} pInitOptions
53
57
  * @returns {string}
54
58
  */
55
59
  function buildTsPreCompilationDepsAttribute(pInitOptions) {
@@ -59,7 +63,7 @@ function buildTsPreCompilationDepsAttribute(pInitOptions) {
59
63
  }
60
64
 
61
65
  /**
62
- * @param {import("./types.js").IInitConfig} pInitOptions
66
+ * @param {IInitConfig} pInitOptions
63
67
  * @returns {string}
64
68
  */
65
69
  function buildCombinedDependenciesAttribute(pInitOptions) {
@@ -69,7 +73,7 @@ function buildCombinedDependenciesAttribute(pInitOptions) {
69
73
  }
70
74
 
71
75
  /**
72
- * @param {import("./types.js").IInitConfig} pInitOptions
76
+ * @param {IInitConfig} pInitOptions
73
77
  * @returns {string}
74
78
  */
75
79
  function buildTsOrJsConfigAttribute(pInitOptions) {
@@ -89,7 +93,7 @@ function buildTsOrJsConfigAttribute(pInitOptions) {
89
93
  }
90
94
 
91
95
  /**
92
- * @param {import("./types.js").IInitConfig} pInitOptions
96
+ * @param {IInitConfig} pInitOptions
93
97
  * @returns {string}
94
98
  */
95
99
  function buildWebpackConfigAttribute(pInitOptions) {
@@ -107,7 +111,7 @@ function buildWebpackConfigAttribute(pInitOptions) {
107
111
  }
108
112
 
109
113
  /**
110
- * @param {import("./types.js").IInitConfig} pInitOptions
114
+ * @param {IInitConfig} pInitOptions
111
115
  * @returns {string}
112
116
  */
113
117
  function buildBabelConfigAttribute(pInitOptions) {
@@ -121,7 +125,7 @@ function buildBabelConfigAttribute(pInitOptions) {
121
125
  }
122
126
 
123
127
  /**
124
- * @param {import("./types.js").IInitConfig} pInitOptions
128
+ * @param {IInitConfig} pInitOptions
125
129
  * @returns {string}
126
130
  */
127
131
  function buildExtensionsAttribute(pInitOptions) {
@@ -131,7 +135,7 @@ function buildExtensionsAttribute(pInitOptions) {
131
135
  }
132
136
 
133
137
  /**
134
- * @param {import("./types.js").IInitConfig} pInitOptions
138
+ * @param {IInitConfig} pInitOptions
135
139
  * @returns {string}
136
140
  */
137
141
  function buildMainFieldsAttribute(pInitOptions) {
@@ -149,7 +153,7 @@ function buildMainFieldsAttribute(pInitOptions) {
149
153
  * Creates a .dependency-cruiser config with a set of basic validations
150
154
  * to the current directory.
151
155
  *
152
- * @param {import("./types.js").IInitConfig} pInitOptions ('Normalized') options that influence the shape of
156
+ * @param {IInitConfig} pInitOptions ('Normalized') options that influence the shape of
153
157
  * the configuration
154
158
  * @returns {string} the configuration as a string
155
159
  */
@@ -228,6 +228,17 @@ module.exports = {
228
228
 
229
229
  // moduleSystems: ['cjs', 'es6'],
230
230
 
231
+ /*
232
+ false: don't look at JSDoc imports
233
+ true: dependency-cruiser will detect dependencies in JSDoc-style
234
+ import statements. Implies "parser": "tsc", so the dependency-cruiser
235
+ will use the typescript parser for JavaScript files.
236
+
237
+ For this to work the typescript compiler will need to be installed in the
238
+ same spot as you're running dependency-cruiser from.
239
+ */
240
+ // detectJSDocImports: true,
241
+
231
242
  /* prefix for links in html and svg output (e.g. 'https://github.com/you/yourrepo/blob/main/'
232
243
  to open it on your online repo or \`vscode://file/$\{process.cwd()}/\` to
233
244
  open it in visual studio code),
@@ -20,17 +20,21 @@ import {
20
20
  } from "./environment-helpers.mjs";
21
21
  import { writeRunScriptsToManifest } from "./write-run-scripts-to-manifest.mjs";
22
22
 
23
+ /**
24
+ * @import { IInitConfig, IPartialInitConfig, OneShotConfigIDType } from "./types.js";
25
+ */
26
+
23
27
  const PACKAGE_MANIFEST = `./${_PACKAGE_MANIFEST}`;
24
28
 
25
29
  /**
26
30
  * Create a initialization configuration based on guessed defaults
27
31
  * (e.g. a tsconfig exists => use it and assume typescript is used)
28
32
  *
29
- * @param {import("./types").OneShotConfigIDType} pOneShotConfigId
30
- * @return {import("./types").IPartialInitConfig} an initialization configuration
33
+ * @param {OneShotConfigIDType} pOneShotConfigId
34
+ * @return {IPartialInitConfig} an initialization configuration
31
35
  */
32
36
  function getOneShotConfig(pOneShotConfigId) {
33
- /** @type {import("./types").IPartialInitConfig} */
37
+ /** @type {IPartialInitConfig} */
34
38
  const lBaseConfig = {
35
39
  isMonoRepo: isLikelyMonoRepo(),
36
40
  isTypeModule: isTypeModule(),
@@ -46,7 +50,7 @@ function getOneShotConfig(pOneShotConfigId) {
46
50
  babelConfig: getBabelConfigCandidates().shift(),
47
51
  specifyResolutionExtensions: true,
48
52
  };
49
- /** @type {Map<import("./types").OneShotConfigIDType, import("./types").IPartialInitConfig>} */
53
+ /** @type {Map<OneShotConfigIDType, IPartialInitConfig>} */
50
54
  const lOneShotConfigs = new Map([
51
55
  ["yes", lBaseConfig],
52
56
  [
@@ -63,7 +67,7 @@ function getOneShotConfig(pOneShotConfigId) {
63
67
 
64
68
  /**
65
69
  *
66
- * @param {import("./types").IInitConfig} pNormalizedInitConfig
70
+ * @param {IInitConfig} pNormalizedInitConfig
67
71
  */
68
72
  function manifestIsUpdatable(pNormalizedInitConfig) {
69
73
  return (
@@ -73,7 +77,7 @@ function manifestIsUpdatable(pNormalizedInitConfig) {
73
77
  }
74
78
 
75
79
  /**
76
- * @param {boolean|import("./types").OneShotConfigIDType} pInit
80
+ * @param {boolean|OneShotConfigIDType} pInit
77
81
  * @param {string=} pConfigFileName
78
82
  * @param {{stdout: NodeJS.WritableStream, stderr: NodeJS.WritableStream}=} pStreams
79
83
  */
@@ -8,7 +8,11 @@ import findExtensions from "./find-extensions.mjs";
8
8
  import meta from "#meta.cjs";
9
9
 
10
10
  /**
11
- * @param {import("./types.js").IInitConfig} pInitOptions
11
+ * @import { IInitConfig, IPartialInitConfig } from "./types.js";
12
+ */
13
+
14
+ /**
15
+ * @param {IInitConfig} pInitOptions
12
16
  * @param {string[]} pExtensions
13
17
  * @returns {boolean}
14
18
  */
@@ -25,7 +29,7 @@ function usesTypeScript(pInitOptions, pExtensions) {
25
29
  }
26
30
 
27
31
  /**
28
- * @param {import("./types.js").IInitConfig} pInitOptions
32
+ * @param {IInitConfig} pInitOptions
29
33
  * @returns {string[]}
30
34
  */
31
35
  function getExtensions(pInitOptions) {
@@ -38,8 +42,8 @@ function getExtensions(pInitOptions) {
38
42
  }
39
43
 
40
44
  /**
41
- * @param {import("./types.js").IPartialInitConfig} pInitOptions
42
- * @return {import("./types.js").IPartialInitConfig}
45
+ * @param {IPartialInitConfig} pInitOptions
46
+ * @return {IPartialInitConfig}
43
47
  */
44
48
  function populate(pInitOptions) {
45
49
  const lReturnValue = {
@@ -66,8 +70,8 @@ function populate(pInitOptions) {
66
70
 
67
71
  /**
68
72
  *
69
- * @param {import("./types.js").IPartialInitConfig} pInitOptions
70
- * @return {import("./types.js").IInitConfig}
73
+ * @param {IPartialInitConfig} pInitOptions
74
+ * @return {IInitConfig}
71
75
  */
72
76
  export default function normalizeInitOptions(pInitOptions) {
73
77
  let lReturnValue = populate(pInitOptions);
@@ -65,7 +65,7 @@ function formatMessage(pMessage, pLevel) {
65
65
  export function formatTime(
66
66
  pNumber,
67
67
  pConversionMultiplier = MS_PER_SECOND,
68
- pLevel,
68
+ pLevel = INFO,
69
69
  ) {
70
70
  return formatMessage(
71
71
  gTimeFormat(pConversionMultiplier * pNumber)
@@ -17,6 +17,7 @@ function getOptionValue(pDefault) {
17
17
  return (pValue) => (typeof pValue === "string" ? pValue : pDefault);
18
18
  }
19
19
 
20
+ // eslint-disable-next-line complexity
20
21
  function normalizeConfigFileName(pCliOptions, pConfigWrapperName, pDefault) {
21
22
  let lOptions = structuredClone(pCliOptions);
22
23
 
@@ -28,10 +28,9 @@ function writeToFile(pOutputTo, pDependencyString) {
28
28
  */
29
29
  function writeToStdOut(pString, pBufferSize = PIPE_BUFFER_SIZE) {
30
30
  const lNumberOfChunks = Math.ceil(pString.length / pBufferSize);
31
- let lIndex = 0;
32
31
 
33
32
  /* eslint no-plusplus: 0 */
34
- for (lIndex = 0; lIndex < lNumberOfChunks; lIndex++) {
33
+ for (let lIndex = 0; lIndex < lNumberOfChunks; lIndex++) {
35
34
  const lChunkStart = lIndex * pBufferSize;
36
35
  process.stdout.write(
37
36
  pString.substring(lChunkStart, lChunkStart + pBufferSize),
@@ -68,7 +68,6 @@ async function getConfig(pBabelConfigFileName) {
68
68
  `${`The babel config '${pBabelConfigFileName}' is in a format ('${lExtension}')\n`} dependency-cruiser doesn't support yet.\n`,
69
69
  );
70
70
  }
71
- // eslint-disable-next-line no-return-await
72
71
  return await lExtensionToParseFunction.get(lExtension)(pBabelConfigFileName);
73
72
  }
74
73
 
@@ -1,9 +1,13 @@
1
1
  import extractDepcruiseConfig from "./extract-depcruise-config/index.mjs";
2
2
 
3
3
  /**
4
- *
5
- * @param {import('../../../types/configuration.mjs').IConfiguration}} pConfiguration
6
- * @returns {import('../../../types/configuration.mjs').ICruiseOptions}
4
+ * @import { IConfiguration } from "../../types/configuration.mjs";
5
+ * @import { ICruiseOptions } from "../../types/options.mjs";
6
+ */
7
+
8
+ /**
9
+ * @param {IConfiguration} pConfiguration
10
+ * @returns {ICruiseOptions}
7
11
  */
8
12
  function configuration2options(pConfiguration) {
9
13
  /* c8 ignore next 1 */
@@ -20,7 +24,7 @@ function configuration2options(pConfiguration) {
20
24
  /**
21
25
  *
22
26
  * @param {string} pConfigFileName
23
- * @returns {Promise<import('../../../types/configuration.mjs').ICruiseOptions>}
27
+ * @returns {Promise<ICruiseOptions>}
24
28
  */
25
29
  export default async function extractDepcruiseOptions(pConfigFileName) {
26
30
  const lReturnValue = await extractDepcruiseConfig(pConfigFileName);
@@ -3,8 +3,8 @@ import json5 from "json5";
3
3
  import makeAbsolute from "./make-absolute.mjs";
4
4
 
5
5
  /**
6
- * @typedef {import("../../types/violations.d.mjs").IViolation} IViolation
7
- * @typedef {import("../../types/shared-types.d.mts").DependencyType} DependencyType
6
+ * @import { IViolation } from "../../types/violations.mjs"
7
+ * @import { DependencyType } from "../../types/shared-types.mjs"
8
8
  *
9
9
  * @typedef {IViolation & {cycle: Array<{name: string, dependencyTypes: Array<DependencyType>}>} | {cycle: Array<DependencyType>}} IMaybeOldFormatViolation
10
10
  */
@@ -21,11 +21,11 @@ import makeAbsolute from "./make-absolute.mjs";
21
21
  */
22
22
  function makeForwardCompatible(pKnownViolation) {
23
23
  let lReturnValue = pKnownViolation;
24
- if (Boolean(pKnownViolation.cycle)) {
24
+ if (pKnownViolation.cycle) {
25
25
  lReturnValue = {
26
26
  ...pKnownViolation,
27
27
  cycle: pKnownViolation.cycle.map((pModule) => {
28
- if (Boolean(pModule.name)) {
28
+ if (pModule.name) {
29
29
  return pModule;
30
30
  }
31
31
  return {
@@ -35,11 +35,11 @@ function makeForwardCompatible(pKnownViolation) {
35
35
  }),
36
36
  };
37
37
  }
38
- if (Boolean(pKnownViolation.via)) {
38
+ if (pKnownViolation.via) {
39
39
  lReturnValue = {
40
40
  ...pKnownViolation,
41
41
  via: pKnownViolation.via.map((pModule) => {
42
- if (Boolean(pModule.name)) {
42
+ if (pModule.name) {
43
43
  return pModule;
44
44
  }
45
45
  return {
@@ -90,7 +90,7 @@ async function attemptImport(pAbsoluteWebpackConfigFileName) {
90
90
  * module system. If we'd use a dynamic import, these monkey-patches wouldn't
91
91
  * be used.
92
92
  */
93
- /* eslint node/global-require:0, security/detect-non-literal-require:0, import/no-dynamic-require:0 */
93
+ /* eslint n/global-require:0, security/detect-non-literal-require:0, import/no-dynamic-require:0 */
94
94
  return require(pAbsoluteWebpackConfigFileName);
95
95
  }
96
96
  } catch (pError) {
@@ -116,7 +116,7 @@ export default function softenKnownViolations(
116
116
  pKnownViolations,
117
117
  pSoftenedSeverity = "ignore",
118
118
  ) {
119
- if (Boolean(pKnownViolations)) {
119
+ if (pKnownViolations) {
120
120
  bus.info("analyzing: comparing against known errors");
121
121
  return pModules.map((pModule) =>
122
122
  softenKnownViolation(pModule, pKnownViolations, pSoftenedSeverity),
@@ -7,6 +7,7 @@ function removeNames(pRule) {
7
7
  return lReturnValue;
8
8
  }
9
9
 
10
+ // eslint-disable-next-line complexity
10
11
  export default function addRuleSetUsed(pOptions) {
11
12
  const lForbidden = pOptions?.ruleSet?.forbidden;
12
13
  const lAllowed = pOptions?.ruleSet?.allowed;
@@ -12,7 +12,6 @@ function cutNonTransgressions(pModule) {
12
12
  };
13
13
  }
14
14
 
15
- // eslint-disable-next-line complexity
16
15
  function toDependencyViolationSummary(pRule, pModule, pDependency, pRuleSet) {
17
16
  let lReturnValue = {
18
17
  type: "dependency",
@@ -4,6 +4,7 @@ const SHAREABLE_OPTIONS = [
4
4
  "cache",
5
5
  "collapse",
6
6
  "combinedDependencies",
7
+ "detectJSDocImports",
7
8
  "doNotFollow",
8
9
  "enhancedResolveOptions",
9
10
  "exclude",
@@ -20,6 +21,7 @@ const SHAREABLE_OPTIONS = [
20
21
  "moduleSystems",
21
22
  "outputTo",
22
23
  "outputType",
24
+ "parser",
23
25
  "prefix",
24
26
  "preserveSymlinks",
25
27
  "reaches",