knip 5.68.0 → 5.69.1

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 (310) hide show
  1. package/dist/CatalogCounselor.d.ts +18 -0
  2. package/dist/CatalogCounselor.js +50 -0
  3. package/dist/ConfigurationChief.d.ts +6 -0
  4. package/dist/ConfigurationChief.js +3 -1
  5. package/dist/DependencyDeputy.js +10 -3
  6. package/dist/IssueFixer.d.ts +1 -6
  7. package/dist/IssueFixer.js +75 -46
  8. package/dist/JsonCatalogPeeker.d.ts +12 -0
  9. package/dist/JsonCatalogPeeker.js +68 -0
  10. package/dist/PackagePeeker.js +1 -0
  11. package/dist/YamlCatalogPeeker.d.ts +12 -0
  12. package/dist/YamlCatalogPeeker.js +66 -0
  13. package/dist/binaries/bash-parser.js +1 -1
  14. package/dist/compilers/index.d.ts +14 -4
  15. package/dist/constants.d.ts +9 -1
  16. package/dist/constants.js +9 -0
  17. package/dist/graph/analyze.d.ts +3 -1
  18. package/dist/graph/analyze.js +22 -16
  19. package/dist/graph/build.d.ts +3 -1
  20. package/dist/graph/build.js +2 -1
  21. package/dist/index.js +5 -2
  22. package/dist/plugins/_template/index.d.ts +3 -12
  23. package/dist/plugins/_template/index.js +2 -1
  24. package/dist/plugins/angular/index.d.ts +3 -10
  25. package/dist/plugins/angular/index.js +2 -1
  26. package/dist/plugins/astro/index.d.ts +3 -13
  27. package/dist/plugins/astro/index.js +2 -1
  28. package/dist/plugins/astro-db/index.d.ts +3 -8
  29. package/dist/plugins/astro-db/index.js +2 -1
  30. package/dist/plugins/ava/index.d.ts +3 -11
  31. package/dist/plugins/ava/index.js +2 -1
  32. package/dist/plugins/babel/index.d.ts +4 -10
  33. package/dist/plugins/babel/index.js +2 -1
  34. package/dist/plugins/biome/index.d.ts +3 -10
  35. package/dist/plugins/biome/index.js +2 -1
  36. package/dist/plugins/bumpp/index.d.ts +3 -8
  37. package/dist/plugins/bumpp/index.js +2 -1
  38. package/dist/plugins/bun/index.d.ts +3 -11
  39. package/dist/plugins/bun/index.js +2 -1
  40. package/dist/plugins/c8/index.d.ts +3 -10
  41. package/dist/plugins/c8/index.js +2 -1
  42. package/dist/plugins/capacitor/index.d.ts +3 -10
  43. package/dist/plugins/capacitor/index.js +2 -1
  44. package/dist/plugins/changelogen/index.d.ts +3 -9
  45. package/dist/plugins/changelogen/index.js +2 -1
  46. package/dist/plugins/changelogithub/index.d.ts +3 -9
  47. package/dist/plugins/changelogithub/index.js +2 -1
  48. package/dist/plugins/changesets/index.d.ts +3 -11
  49. package/dist/plugins/changesets/index.js +2 -1
  50. package/dist/plugins/commitizen/index.d.ts +3 -12
  51. package/dist/plugins/commitizen/index.js +2 -1
  52. package/dist/plugins/commitlint/index.d.ts +3 -10
  53. package/dist/plugins/commitlint/index.js +2 -1
  54. package/dist/plugins/convex/index.d.ts +3 -8
  55. package/dist/plugins/convex/index.js +2 -1
  56. package/dist/plugins/create-typescript-app/index.d.ts +3 -8
  57. package/dist/plugins/create-typescript-app/index.js +2 -1
  58. package/dist/plugins/cspell/index.d.ts +3 -10
  59. package/dist/plugins/cspell/index.js +2 -1
  60. package/dist/plugins/cucumber/index.d.ts +3 -11
  61. package/dist/plugins/cucumber/index.js +2 -1
  62. package/dist/plugins/cypress/index.d.ts +3 -11
  63. package/dist/plugins/cypress/index.js +2 -1
  64. package/dist/plugins/danger/index.d.ts +3 -8
  65. package/dist/plugins/danger/index.js +2 -1
  66. package/dist/plugins/dependency-cruiser/index.d.ts +3 -12
  67. package/dist/plugins/dependency-cruiser/index.js +2 -1
  68. package/dist/plugins/docusaurus/index.d.ts +3 -12
  69. package/dist/plugins/docusaurus/index.js +2 -1
  70. package/dist/plugins/dotenv/index.d.ts +3 -8
  71. package/dist/plugins/dotenv/index.js +2 -1
  72. package/dist/plugins/drizzle/index.d.ts +3 -10
  73. package/dist/plugins/drizzle/index.js +2 -1
  74. package/dist/plugins/eleventy/index.d.ts +3 -11
  75. package/dist/plugins/eleventy/index.js +2 -1
  76. package/dist/plugins/eslint/helpers.d.ts +1 -0
  77. package/dist/plugins/eslint/helpers.js +14 -1
  78. package/dist/plugins/eslint/index.d.ts +3 -19
  79. package/dist/plugins/eslint/index.js +7 -2
  80. package/dist/plugins/expo/index.d.ts +3 -11
  81. package/dist/plugins/expo/index.js +2 -1
  82. package/dist/plugins/gatsby/index.d.ts +3 -11
  83. package/dist/plugins/gatsby/index.js +2 -1
  84. package/dist/plugins/github-action/index.d.ts +3 -9
  85. package/dist/plugins/github-action/index.js +2 -1
  86. package/dist/plugins/github-actions/index.d.ts +3 -10
  87. package/dist/plugins/github-actions/index.js +2 -1
  88. package/dist/plugins/glob/index.d.ts +3 -11
  89. package/dist/plugins/glob/index.js +2 -1
  90. package/dist/plugins/graphql-codegen/index.d.ts +3 -11
  91. package/dist/plugins/graphql-codegen/index.js +2 -1
  92. package/dist/plugins/hardhat/index.d.ts +3 -9
  93. package/dist/plugins/hardhat/index.js +2 -1
  94. package/dist/plugins/husky/index.d.ts +3 -10
  95. package/dist/plugins/husky/index.js +2 -1
  96. package/dist/plugins/i18next-parser/index.d.ts +3 -12
  97. package/dist/plugins/i18next-parser/index.js +2 -1
  98. package/dist/plugins/index.d.ts +118 -942
  99. package/dist/plugins/index.js +2 -0
  100. package/dist/plugins/jest/index.d.ts +3 -14
  101. package/dist/plugins/jest/index.js +2 -1
  102. package/dist/plugins/karma/index.d.ts +3 -10
  103. package/dist/plugins/karma/index.js +2 -1
  104. package/dist/plugins/ladle/index.d.ts +3 -12
  105. package/dist/plugins/ladle/index.js +2 -1
  106. package/dist/plugins/lefthook/index.d.ts +3 -9
  107. package/dist/plugins/lefthook/index.js +2 -1
  108. package/dist/plugins/lint-staged/index.d.ts +3 -10
  109. package/dist/plugins/lint-staged/index.js +2 -1
  110. package/dist/plugins/linthtml/index.d.ts +3 -11
  111. package/dist/plugins/linthtml/index.js +2 -1
  112. package/dist/plugins/lockfile-lint/index.d.ts +3 -8
  113. package/dist/plugins/lockfile-lint/index.js +2 -1
  114. package/dist/plugins/lost-pixel/index.d.ts +3 -8
  115. package/dist/plugins/lost-pixel/index.js +2 -1
  116. package/dist/plugins/markdownlint/index.d.ts +3 -10
  117. package/dist/plugins/markdownlint/index.js +2 -1
  118. package/dist/plugins/mdx/index.d.ts +3 -0
  119. package/dist/plugins/mdx/index.js +32 -0
  120. package/dist/plugins/mdx/types.d.ts +3 -0
  121. package/dist/plugins/mdx/types.js +1 -0
  122. package/dist/plugins/mdxlint/index.d.ts +3 -10
  123. package/dist/plugins/mdxlint/index.js +7 -2
  124. package/dist/plugins/metro/index.d.ts +3 -11
  125. package/dist/plugins/metro/index.js +2 -1
  126. package/dist/plugins/mocha/index.d.ts +3 -14
  127. package/dist/plugins/mocha/index.js +2 -1
  128. package/dist/plugins/moonrepo/index.d.ts +3 -11
  129. package/dist/plugins/moonrepo/index.js +2 -1
  130. package/dist/plugins/msw/index.d.ts +3 -11
  131. package/dist/plugins/msw/index.js +2 -1
  132. package/dist/plugins/nano-staged/index.d.ts +3 -10
  133. package/dist/plugins/nano-staged/index.js +2 -1
  134. package/dist/plugins/nest/index.d.ts +3 -10
  135. package/dist/plugins/nest/index.js +2 -1
  136. package/dist/plugins/netlify/index.d.ts +3 -11
  137. package/dist/plugins/netlify/index.js +2 -1
  138. package/dist/plugins/next/index.d.ts +3 -10
  139. package/dist/plugins/next/index.js +6 -6
  140. package/dist/plugins/node/index.d.ts +3 -17
  141. package/dist/plugins/node/index.js +2 -1
  142. package/dist/plugins/node-modules-inspector/index.d.ts +3 -11
  143. package/dist/plugins/node-modules-inspector/index.js +2 -1
  144. package/dist/plugins/nodemon/index.d.ts +3 -10
  145. package/dist/plugins/nodemon/index.js +2 -1
  146. package/dist/plugins/npm-package-json-lint/index.d.ts +3 -11
  147. package/dist/plugins/npm-package-json-lint/index.js +2 -1
  148. package/dist/plugins/nuxt/index.d.ts +3 -12
  149. package/dist/plugins/nuxt/index.js +2 -1
  150. package/dist/plugins/nx/index.d.ts +3 -14
  151. package/dist/plugins/nx/index.js +2 -1
  152. package/dist/plugins/nyc/index.d.ts +3 -10
  153. package/dist/plugins/nyc/index.js +2 -1
  154. package/dist/plugins/oclif/index.d.ts +3 -10
  155. package/dist/plugins/oclif/index.js +2 -1
  156. package/dist/plugins/oxlint/index.d.ts +3 -11
  157. package/dist/plugins/oxlint/index.js +2 -1
  158. package/dist/plugins/playwright/index.d.ts +3 -15
  159. package/dist/plugins/playwright/index.js +2 -1
  160. package/dist/plugins/playwright-ct/index.d.ts +3 -10
  161. package/dist/plugins/playwright-ct/index.js +2 -1
  162. package/dist/plugins/playwright-test/index.d.ts +3 -12
  163. package/dist/plugins/playwright-test/index.js +2 -1
  164. package/dist/plugins/plop/index.d.ts +3 -8
  165. package/dist/plugins/plop/index.js +2 -1
  166. package/dist/plugins/pnpm/index.d.ts +3 -8
  167. package/dist/plugins/pnpm/index.js +2 -1
  168. package/dist/plugins/postcss/index.d.ts +3 -10
  169. package/dist/plugins/postcss/index.js +2 -1
  170. package/dist/plugins/preconstruct/index.d.ts +3 -10
  171. package/dist/plugins/preconstruct/index.js +2 -1
  172. package/dist/plugins/prettier/index.d.ts +3 -10
  173. package/dist/plugins/prettier/index.js +2 -1
  174. package/dist/plugins/prisma/index.d.ts +3 -13
  175. package/dist/plugins/prisma/index.js +10 -2
  176. package/dist/plugins/prisma/types.d.ts +3 -0
  177. package/dist/plugins/react-cosmos/index.d.ts +3 -11
  178. package/dist/plugins/react-cosmos/index.js +2 -1
  179. package/dist/plugins/react-router/index.d.ts +3 -10
  180. package/dist/plugins/react-router/index.js +3 -2
  181. package/dist/plugins/relay/index.d.ts +3 -15
  182. package/dist/plugins/relay/index.js +2 -1
  183. package/dist/plugins/release-it/index.d.ts +3 -10
  184. package/dist/plugins/release-it/index.js +2 -1
  185. package/dist/plugins/remark/index.d.ts +3 -11
  186. package/dist/plugins/remark/index.js +2 -1
  187. package/dist/plugins/remix/index.d.ts +3 -9
  188. package/dist/plugins/remix/index.js +2 -1
  189. package/dist/plugins/rollup/index.d.ts +3 -10
  190. package/dist/plugins/rollup/index.js +2 -1
  191. package/dist/plugins/rsbuild/index.d.ts +3 -10
  192. package/dist/plugins/rsbuild/index.js +2 -1
  193. package/dist/plugins/rslib/index.d.ts +3 -10
  194. package/dist/plugins/rslib/index.js +2 -1
  195. package/dist/plugins/rspack/index.d.ts +3 -10
  196. package/dist/plugins/rspack/index.js +2 -1
  197. package/dist/plugins/rstest/index.d.ts +3 -10
  198. package/dist/plugins/rstest/index.js +2 -1
  199. package/dist/plugins/semantic-release/index.d.ts +3 -12
  200. package/dist/plugins/semantic-release/index.js +2 -1
  201. package/dist/plugins/sentry/index.d.ts +3 -8
  202. package/dist/plugins/sentry/index.js +2 -1
  203. package/dist/plugins/simple-git-hooks/index.d.ts +3 -10
  204. package/dist/plugins/simple-git-hooks/index.js +2 -1
  205. package/dist/plugins/size-limit/index.d.ts +3 -9
  206. package/dist/plugins/size-limit/index.js +2 -1
  207. package/dist/plugins/sst/index.d.ts +3 -9
  208. package/dist/plugins/sst/index.js +2 -1
  209. package/dist/plugins/starlight/index.d.ts +3 -9
  210. package/dist/plugins/starlight/index.js +2 -1
  211. package/dist/plugins/storybook/index.d.ts +3 -12
  212. package/dist/plugins/storybook/index.js +2 -1
  213. package/dist/plugins/stryker/index.d.ts +3 -10
  214. package/dist/plugins/stryker/index.js +2 -1
  215. package/dist/plugins/stylelint/index.d.ts +3 -10
  216. package/dist/plugins/stylelint/index.js +2 -1
  217. package/dist/plugins/svelte/index.d.ts +3 -10
  218. package/dist/plugins/svelte/index.js +2 -1
  219. package/dist/plugins/svgo/index.d.ts +3 -8
  220. package/dist/plugins/svgo/index.js +2 -1
  221. package/dist/plugins/syncpack/index.d.ts +3 -8
  222. package/dist/plugins/syncpack/index.js +2 -1
  223. package/dist/plugins/tailwind/index.d.ts +3 -8
  224. package/dist/plugins/tailwind/index.js +2 -1
  225. package/dist/plugins/travis/index.d.ts +3 -10
  226. package/dist/plugins/travis/index.js +2 -1
  227. package/dist/plugins/ts-node/index.d.ts +3 -14
  228. package/dist/plugins/ts-node/index.js +2 -1
  229. package/dist/plugins/tsdown/index.d.ts +3 -13
  230. package/dist/plugins/tsdown/index.js +2 -1
  231. package/dist/plugins/tsup/index.d.ts +3 -13
  232. package/dist/plugins/tsup/index.js +2 -1
  233. package/dist/plugins/tsx/index.d.ts +3 -15
  234. package/dist/plugins/tsx/index.js +2 -1
  235. package/dist/plugins/typedoc/index.d.ts +3 -16
  236. package/dist/plugins/typedoc/index.js +2 -1
  237. package/dist/plugins/typescript/index.d.ts +3 -18
  238. package/dist/plugins/typescript/index.js +2 -1
  239. package/dist/plugins/unbuild/index.d.ts +3 -10
  240. package/dist/plugins/unbuild/index.js +2 -1
  241. package/dist/plugins/unocss/index.d.ts +3 -8
  242. package/dist/plugins/unocss/index.js +2 -1
  243. package/dist/plugins/vercel-og/index.d.ts +3 -8
  244. package/dist/plugins/vercel-og/index.js +2 -1
  245. package/dist/plugins/vike/index.d.ts +3 -8
  246. package/dist/plugins/vike/index.js +2 -1
  247. package/dist/plugins/vite/index.d.ts +3 -10
  248. package/dist/plugins/vite/index.js +2 -1
  249. package/dist/plugins/vitest/index.d.ts +3 -16
  250. package/dist/plugins/vitest/index.js +2 -1
  251. package/dist/plugins/vue/index.d.ts +3 -10
  252. package/dist/plugins/vue/index.js +2 -1
  253. package/dist/plugins/webdriver-io/index.d.ts +3 -10
  254. package/dist/plugins/webdriver-io/index.js +2 -1
  255. package/dist/plugins/webpack/index.d.ts +3 -13
  256. package/dist/plugins/webpack/index.js +2 -1
  257. package/dist/plugins/wireit/index.d.ts +3 -10
  258. package/dist/plugins/wireit/index.js +2 -1
  259. package/dist/plugins/wrangler/index.d.ts +3 -10
  260. package/dist/plugins/wrangler/index.js +2 -1
  261. package/dist/plugins/xo/index.d.ts +3 -11
  262. package/dist/plugins/xo/index.js +2 -1
  263. package/dist/plugins/yarn/index.d.ts +3 -9
  264. package/dist/plugins/yarn/index.js +2 -1
  265. package/dist/plugins/yorkie/index.d.ts +3 -11
  266. package/dist/plugins/yorkie/index.js +2 -1
  267. package/dist/reporters/json.js +1 -0
  268. package/dist/reporters/util/util.d.ts +1 -1
  269. package/dist/schema/configuration.d.ts +14 -4
  270. package/dist/schema/configuration.js +1 -0
  271. package/dist/schema/plugins.d.ts +5 -0
  272. package/dist/schema/plugins.js +1 -0
  273. package/dist/types/PluginNames.d.ts +2 -2
  274. package/dist/types/PluginNames.js +1 -0
  275. package/dist/types/config.d.ts +2 -0
  276. package/dist/types/exports.d.ts +1 -1
  277. package/dist/types/imports.d.ts +1 -3
  278. package/dist/types/issues.d.ts +3 -0
  279. package/dist/types/package-json.d.ts +12 -1
  280. package/dist/types.d.ts +1 -1
  281. package/dist/typescript/ast-helpers.d.ts +1 -1
  282. package/dist/typescript/get-imports-and-exports.js +18 -17
  283. package/dist/typescript/visitors/dynamic-imports/importCall.js +23 -15
  284. package/dist/typescript/visitors/dynamic-imports/importType.js +7 -1
  285. package/dist/typescript/visitors/dynamic-imports/index.js +2 -1
  286. package/dist/typescript/visitors/dynamic-imports/jsDocType.js +13 -2
  287. package/dist/typescript/visitors/dynamic-imports/requireCall.js +13 -9
  288. package/dist/typescript/visitors/dynamic-imports/resolveCall.js +7 -1
  289. package/dist/typescript/visitors/dynamic-imports/urlConstructor.d.ts +3 -0
  290. package/dist/typescript/visitors/dynamic-imports/urlConstructor.js +24 -0
  291. package/dist/typescript/visitors/exports/exportDeclaration.js +1 -1
  292. package/dist/typescript/visitors/helpers.js +13 -2
  293. package/dist/typescript/visitors/imports/importDeclaration.js +9 -8
  294. package/dist/typescript/visitors/imports/importEqualsDeclaration.js +9 -1
  295. package/dist/typescript/visitors/imports/reExportDeclaration.js +10 -5
  296. package/dist/util/catalog.d.ts +6 -0
  297. package/dist/util/catalog.js +62 -0
  298. package/dist/util/cli-arguments.d.ts +1 -1
  299. package/dist/util/cli-arguments.js +3 -3
  300. package/dist/util/create-options.d.ts +17 -4
  301. package/dist/util/create-options.js +8 -5
  302. package/dist/util/errors.js +11 -1
  303. package/dist/util/get-included-issue-types.d.ts +1 -1
  304. package/dist/util/get-included-issue-types.js +3 -2
  305. package/dist/util/get-referenced-inputs.js +4 -0
  306. package/dist/util/trace.js +4 -4
  307. package/dist/version.d.ts +1 -1
  308. package/dist/version.js +1 -1
  309. package/package.json +1 -1
  310. package/schema.json +4 -0
@@ -4,7 +4,7 @@ import { getPackageNameFromModuleSpecifier } from '../util/modules.js';
4
4
  import { findMatch } from '../util/regex.js';
5
5
  import { getShouldIgnoreHandler, getShouldIgnoreTagHandler } from '../util/tag.js';
6
6
  import { createAndPrintTrace, printTrace } from '../util/trace.js';
7
- export const analyze = async ({ analyzedFiles, chief, collector, deputy, entryPaths, factory, fixer, graph, streamer, unreferencedFiles, options, }) => {
7
+ export const analyze = async ({ analyzedFiles, counselor, chief, collector, deputy, entryPaths, factory, graph, streamer, unreferencedFiles, options, }) => {
8
8
  const shouldIgnore = getShouldIgnoreHandler(options.isProduction);
9
9
  const shouldIgnoreTags = getShouldIgnoreTagHandler(options.tags);
10
10
  const isIdentifierReferenced = getIsIdentifierReferencedHandler(graph, entryPaths, options.isTrace);
@@ -75,7 +75,7 @@ export const analyze = async ({ analyzedFiles, chief, collector, deputy, entryPa
75
75
  if (!isReferenced) {
76
76
  if (isIgnored)
77
77
  continue;
78
- const isIssueAdded = collector.addIssue({
78
+ collector.addIssue({
79
79
  type: 'enumMembers',
80
80
  filePath,
81
81
  workspace: workspace.name,
@@ -84,9 +84,8 @@ export const analyze = async ({ analyzedFiles, chief, collector, deputy, entryPa
84
84
  pos: member.pos,
85
85
  line: member.line,
86
86
  col: member.col,
87
+ fixes: member.fix ? [member.fix] : [],
87
88
  });
88
- if (options.isFix && isIssueAdded && member.fix)
89
- fixer.addUnusedTypeNode(filePath, [member.fix]);
90
89
  }
91
90
  else if (isIgnored) {
92
91
  for (const tagName of exportedItem.jsDocTags) {
@@ -110,7 +109,7 @@ export const analyze = async ({ analyzedFiles, chief, collector, deputy, entryPa
110
109
  }
111
110
  continue;
112
111
  }
113
- const isIssueAdded = collector.addIssue({
112
+ collector.addIssue({
114
113
  type: 'classMembers',
115
114
  filePath,
116
115
  workspace: workspace.name,
@@ -119,9 +118,8 @@ export const analyze = async ({ analyzedFiles, chief, collector, deputy, entryPa
119
118
  pos: member.pos,
120
119
  line: member.line,
121
120
  col: member.col,
121
+ fixes: member.fix ? [member.fix] : [],
122
122
  });
123
- if (options.isFix && isIssueAdded && member.fix)
124
- fixer.addUnusedTypeNode(filePath, [member.fix]);
125
123
  }
126
124
  }
127
125
  continue;
@@ -138,7 +136,7 @@ export const analyze = async ({ analyzedFiles, chief, collector, deputy, entryPa
138
136
  if (!options.isSkipLibs && principal?.hasExternalReferences(filePath, exportedItem))
139
137
  continue;
140
138
  const type = getType(hasStrictlyNsRefs, isType);
141
- const isIssueAdded = collector.addIssue({
139
+ collector.addIssue({
142
140
  type,
143
141
  filePath,
144
142
  workspace: workspace.name,
@@ -148,13 +146,8 @@ export const analyze = async ({ analyzedFiles, chief, collector, deputy, entryPa
148
146
  pos: exportedItem.pos,
149
147
  line: exportedItem.line,
150
148
  col: exportedItem.col,
149
+ fixes: exportedItem.fixes,
151
150
  });
152
- if (options.isFix && isIssueAdded) {
153
- if (isType)
154
- fixer.addUnusedTypeNode(filePath, exportedItem.fixes);
155
- else
156
- fixer.addUnusedExportNode(filePath, exportedItem.fixes);
157
- }
158
151
  }
159
152
  }
160
153
  }
@@ -167,7 +160,7 @@ export const analyze = async ({ analyzedFiles, chief, collector, deputy, entryPa
167
160
  for (const symbols of file.duplicates) {
168
161
  if (symbols.length > 1) {
169
162
  const symbol = symbols.map(s => s.symbol).join('|');
170
- collector.addIssue({ type: 'duplicates', filePath, workspace: ws.name, symbol, symbols });
163
+ collector.addIssue({ type: 'duplicates', filePath, workspace: ws.name, symbol, symbols, fixes: [] });
171
164
  }
172
165
  }
173
166
  }
@@ -185,13 +178,23 @@ export const analyze = async ({ analyzedFiles, chief, collector, deputy, entryPa
185
178
  pos: extImport.pos,
186
179
  line: extImport.line,
187
180
  col: extImport.col,
181
+ fixes: [],
188
182
  });
189
183
  }
190
184
  }
191
185
  if (file.imports?.unresolved) {
192
186
  for (const unresolvedImport of file.imports.unresolved) {
193
187
  const { specifier, pos, line, col } = unresolvedImport;
194
- collector.addIssue({ type: 'unresolved', filePath, workspace: ws.name, symbol: specifier, pos, line, col });
188
+ collector.addIssue({
189
+ type: 'unresolved',
190
+ filePath,
191
+ workspace: ws.name,
192
+ symbol: specifier,
193
+ pos,
194
+ line,
195
+ col,
196
+ fixes: [],
197
+ });
195
198
  }
196
199
  }
197
200
  }
@@ -213,6 +216,9 @@ export const analyze = async ({ analyzedFiles, chief, collector, deputy, entryPa
213
216
  for (const hint of configurationHints)
214
217
  collector.addConfigurationHint(hint);
215
218
  }
219
+ const catalogIssues = await counselor.settleCatalogIssues(options);
220
+ for (const issue of catalogIssues)
221
+ collector.addIssue(issue);
216
222
  const unusedIgnoredWorkspaces = chief.getUnusedIgnoredWorkspaces();
217
223
  for (const identifier of unusedIgnoredWorkspaces) {
218
224
  collector.addConfigurationHint({ type: 'ignoreWorkspaces', identifier });
@@ -1,3 +1,4 @@
1
+ import type { CatalogCounselor } from '../CatalogCounselor.js';
1
2
  import type { ConfigurationChief, Workspace } from '../ConfigurationChief.js';
2
3
  import type { ConsoleStreamer } from '../ConsoleStreamer.js';
3
4
  import type { DependencyDeputy } from '../DependencyDeputy.js';
@@ -9,6 +10,7 @@ import type { MainOptions } from '../util/create-options.js';
9
10
  interface BuildOptions {
10
11
  chief: ConfigurationChief;
11
12
  collector: IssueCollector;
13
+ counselor: CatalogCounselor;
12
14
  deputy: DependencyDeputy;
13
15
  factory: PrincipalFactory;
14
16
  isGitIgnored: (path: string) => boolean;
@@ -16,7 +18,7 @@ interface BuildOptions {
16
18
  workspaces: Workspace[];
17
19
  options: MainOptions;
18
20
  }
19
- export declare function build({ chief, collector, deputy, factory, isGitIgnored, streamer, workspaces, options, }: BuildOptions): Promise<{
21
+ export declare function build({ chief, collector, counselor, deputy, factory, isGitIgnored, streamer, workspaces, options, }: BuildOptions): Promise<{
20
22
  graph: ModuleGraph;
21
23
  entryPaths: Set<string>;
22
24
  analyzedFiles: Set<string>;
@@ -13,7 +13,7 @@ import { getEntrySpecifiersFromManifest, getManifestImportDependencies } from '.
13
13
  import { dirname, extname, isAbsolute, join, relative, toRelative } from '../util/path.js';
14
14
  import { augmentWorkspace, getToSourcePathHandler, getToSourcePathsHandler } from '../util/to-source-path.js';
15
15
  import { WorkspaceWorker } from '../WorkspaceWorker.js';
16
- export async function build({ chief, collector, deputy, factory, isGitIgnored, streamer, workspaces, options, }) {
16
+ export async function build({ chief, collector, counselor, deputy, factory, isGitIgnored, streamer, workspaces, options, }) {
17
17
  const configFilesMap = new Map();
18
18
  const enabledPluginsStore = new Map();
19
19
  const toSourceFilePath = getToSourcePathHandler(chief);
@@ -34,6 +34,7 @@ export async function build({ chief, collector, deputy, factory, isGitIgnored, s
34
34
  manifest,
35
35
  ...chief.getIgnores(name),
36
36
  });
37
+ counselor.addWorkspace(manifest);
37
38
  }
38
39
  collector.addIgnorePatterns(chief.config.ignore.map(p => join(options.cwd, p)));
39
40
  collector.addIgnoreFilesPatterns(chief.config.ignoreFiles.map(p => join(options.cwd, p)));
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { watch } from 'node:fs';
2
2
  import { formatly } from 'formatly';
3
+ import { CatalogCounselor } from './CatalogCounselor.js';
3
4
  import { ConfigurationChief } from './ConfigurationChief.js';
4
5
  import { ConsoleStreamer } from './ConsoleStreamer.js';
5
6
  import { DependencyDeputy } from './DependencyDeputy.js';
@@ -13,7 +14,6 @@ import { debugLogArray, debugLogObject } from './util/debug.js';
13
14
  import { getGitIgnoredHandler } from './util/glob-core.js';
14
15
  import { getWatchHandler } from './util/watch.js';
15
16
  export const main = async (options) => {
16
- const { cwd } = options;
17
17
  debugLogObject('*', 'Unresolved configuration', options);
18
18
  debugLogObject('*', 'Included issue types', options.includedIssueTypes);
19
19
  const chief = new ConfigurationChief(options);
@@ -22,6 +22,7 @@ export const main = async (options) => {
22
22
  const streamer = new ConsoleStreamer(options);
23
23
  const fixer = new IssueFixer(options);
24
24
  const collector = new IssueCollector(options);
25
+ const counselor = new CatalogCounselor(options);
25
26
  streamer.cast('Reading workspace configuration');
26
27
  const workspaces = await chief.getWorkspaces();
27
28
  const isGitIgnored = await getGitIgnoredHandler(options);
@@ -31,6 +32,7 @@ export const main = async (options) => {
31
32
  const { graph, entryPaths, analyzedFiles, unreferencedFiles, analyzeSourceFile } = await build({
32
33
  chief,
33
34
  collector,
35
+ counselor,
34
36
  deputy,
35
37
  factory,
36
38
  isGitIgnored,
@@ -40,6 +42,7 @@ export const main = async (options) => {
40
42
  });
41
43
  const reAnalyze = await analyze({
42
44
  analyzedFiles,
45
+ counselor,
43
46
  chief,
44
47
  collector,
45
48
  deputy,
@@ -74,7 +77,7 @@ export const main = async (options) => {
74
77
  if (options.isFix) {
75
78
  const touchedFiles = await fixer.fixIssues(issues);
76
79
  if (options.isFormat) {
77
- const report = await formatly(Array.from(touchedFiles), { cwd });
80
+ const report = await formatly(Array.from(touchedFiles));
78
81
  if (report.ran && report.result && (report.result.runner === 'virtual' || report.result.code === 0)) {
79
82
  debugLogArray('*', `Formatted files using ${report.formatter.name} (${report.formatter.runner})`, touchedFiles);
80
83
  }
@@ -1,12 +1,3 @@
1
- import type { IsPluginEnabled, ResolveConfig } from '../../types/config.js';
2
- import type { PluginConfig } from './types.js';
3
- declare const _default: {
4
- title: string;
5
- enablers: string[];
6
- isEnabled: IsPluginEnabled;
7
- config: string[];
8
- entry: string[];
9
- production: string[];
10
- resolveConfig: ResolveConfig<PluginConfig>;
11
- };
12
- export default _default;
1
+ import type { Plugin } from '../../types/config.js';
2
+ declare const plugin: Plugin;
3
+ export default plugin;
@@ -10,7 +10,7 @@ const resolveConfig = async (config) => {
10
10
  const inputs = config?.plugins ?? [];
11
11
  return [...inputs].map(id => toDeferResolve(id));
12
12
  };
13
- export default {
13
+ const plugin = {
14
14
  title,
15
15
  enablers,
16
16
  isEnabled,
@@ -19,3 +19,4 @@ export default {
19
19
  production,
20
20
  resolveConfig,
21
21
  };
22
+ export default plugin;
@@ -1,10 +1,3 @@
1
- import type { IsPluginEnabled, ResolveConfig } from '../../types/config.js';
2
- import type { AngularCLIWorkspaceConfiguration } from './types.js';
3
- declare const _default: {
4
- title: string;
5
- enablers: string[];
6
- isEnabled: IsPluginEnabled;
7
- config: string[];
8
- resolveConfig: ResolveConfig<AngularCLIWorkspaceConfiguration>;
9
- };
10
- export default _default;
1
+ import type { Plugin } from '../../types/config.js';
2
+ declare const plugin: Plugin;
3
+ export default plugin;
@@ -108,10 +108,11 @@ const isAngularBuilderRefWithName = ({ builderRef, name }) => {
108
108
  };
109
109
  const PRODUCTION_CONFIG_NAME = 'production';
110
110
  const BUILD_TARGET_NAME = 'build';
111
- export default {
111
+ const plugin = {
112
112
  title,
113
113
  enablers,
114
114
  isEnabled,
115
115
  config,
116
116
  resolveConfig,
117
117
  };
118
+ export default plugin;
@@ -1,14 +1,4 @@
1
- import type { IsPluginEnabled, Resolve, ResolveFromAST } from '../../types/config.js';
1
+ import type { Plugin } from '../../types/config.js';
2
2
  export declare const config: string[];
3
- declare const _default: {
4
- title: string;
5
- enablers: string[];
6
- isEnabled: IsPluginEnabled;
7
- config: string[];
8
- entry: string[];
9
- production: string[];
10
- resolveFromAST: ResolveFromAST;
11
- resolve: Resolve;
12
- project: string[];
13
- };
14
- export default _default;
3
+ declare const plugin: Plugin;
4
+ export default plugin;
@@ -33,7 +33,7 @@ const resolve = options => {
33
33
  }
34
34
  return inputs;
35
35
  };
36
- export default {
36
+ const plugin = {
37
37
  title,
38
38
  enablers,
39
39
  isEnabled,
@@ -44,3 +44,4 @@ export default {
44
44
  resolve,
45
45
  project,
46
46
  };
47
+ export default plugin;
@@ -1,8 +1,3 @@
1
- import type { IsPluginEnabled } from '../../types/config.js';
2
- declare const _default: {
3
- title: string;
4
- enablers: string[];
5
- isEnabled: IsPluginEnabled;
6
- entry: string[];
7
- };
8
- export default _default;
1
+ import type { Plugin } from '../../types/config.js';
2
+ declare const plugin: Plugin;
3
+ export default plugin;
@@ -3,9 +3,10 @@ const title = 'Astro DB';
3
3
  const enablers = ['@astrojs/db'];
4
4
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
5
5
  const entry = ['db/config.{js,ts}', 'db/seed.{js,ts}'];
6
- export default {
6
+ const plugin = {
7
7
  title,
8
8
  enablers,
9
9
  isEnabled,
10
10
  entry,
11
11
  };
12
+ export default plugin;
@@ -1,11 +1,3 @@
1
- import type { IsPluginEnabled, ResolveConfig } from '../../types/config.js';
2
- import type { AvaConfig } from './types.js';
3
- declare const _default: {
4
- title: string;
5
- enablers: string[];
6
- isEnabled: IsPluginEnabled;
7
- config: string[];
8
- entry: string[];
9
- resolveConfig: ResolveConfig<AvaConfig>;
10
- };
11
- export default _default;
1
+ import type { Plugin } from '../../types/config.js';
2
+ declare const plugin: Plugin;
3
+ export default plugin;
@@ -25,7 +25,7 @@ const resolveConfig = async (localConfig, options) => {
25
25
  const fakeCommand = `node ${nodeArgs.join(' ')} ${requireArgs.join(' ')}`;
26
26
  return files.concat(options.getInputsFromScripts(fakeCommand, { knownBinsOnly: true }));
27
27
  };
28
- export default {
28
+ const plugin = {
29
29
  title,
30
30
  enablers,
31
31
  isEnabled,
@@ -33,3 +33,4 @@ export default {
33
33
  entry,
34
34
  resolveConfig,
35
35
  };
36
+ export default plugin;
@@ -1,12 +1,6 @@
1
- import type { IsPluginEnabled, ResolveConfig } from '../../types/config.js';
1
+ import type { Plugin } from '../../types/config.js';
2
2
  import { type Input } from '../../util/input.js';
3
- import type { BabelConfig, BabelConfigObj } from './types.js';
3
+ import type { BabelConfigObj } from './types.js';
4
4
  export declare const getDependenciesFromConfig: (config: BabelConfigObj) => Input[];
5
- declare const _default: {
6
- title: string;
7
- enablers: RegExp[];
8
- isEnabled: IsPluginEnabled;
9
- config: string[];
10
- resolveConfig: ResolveConfig<BabelConfig>;
11
- };
12
- export default _default;
5
+ declare const plugin: Plugin;
6
+ export default plugin;
@@ -26,10 +26,11 @@ const resolveConfig = async (config) => {
26
26
  return [];
27
27
  return getDependenciesFromConfig(config);
28
28
  };
29
- export default {
29
+ const plugin = {
30
30
  title,
31
31
  enablers,
32
32
  isEnabled,
33
33
  config,
34
34
  resolveConfig,
35
35
  };
36
+ export default plugin;
@@ -1,10 +1,3 @@
1
- import type { IsPluginEnabled, ResolveConfig } from '../../types/config.js';
2
- import type { BiomeConfig } from './types.js';
3
- declare const _default: {
4
- title: string;
5
- enablers: string[];
6
- isEnabled: IsPluginEnabled;
7
- config: string[];
8
- resolveConfig: ResolveConfig<BiomeConfig>;
9
- };
10
- export default _default;
1
+ import type { Plugin } from '../../types/config.js';
2
+ declare const plugin: Plugin;
3
+ export default plugin;
@@ -18,10 +18,11 @@ const resolveExtends = (extendsArray, options) => {
18
18
  const resolveConfig = (config, options) => {
19
19
  return [...resolveExtends(arrayify(config.extends), options)];
20
20
  };
21
- export default {
21
+ const plugin = {
22
22
  title,
23
23
  enablers,
24
24
  isEnabled,
25
25
  config,
26
26
  resolveConfig,
27
27
  };
28
+ export default plugin;
@@ -1,8 +1,3 @@
1
- import type { IsPluginEnabled } from '../../types/config.js';
2
- declare const _default: {
3
- title: string;
4
- enablers: string[];
5
- isEnabled: IsPluginEnabled;
6
- entry: string[];
7
- };
8
- export default _default;
1
+ import type { Plugin } from '../../types/config.js';
2
+ declare const plugin: Plugin;
3
+ export default plugin;
@@ -4,9 +4,10 @@ const title = 'bumpp';
4
4
  const enablers = ['bumpp'];
5
5
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
6
6
  const entry = ['package.json', ...toC12config('bump')];
7
- export default {
7
+ const plugin = {
8
8
  title,
9
9
  enablers,
10
10
  isEnabled,
11
11
  entry,
12
12
  };
13
+ export default plugin;
@@ -1,11 +1,3 @@
1
- import type { ResolveConfig } from '../../types/config.js';
2
- import type { PackageJson } from '../../types/package-json.js';
3
- declare const _default: {
4
- title: string;
5
- enablers: string[];
6
- isEnabled: () => boolean;
7
- config: string[];
8
- packageJsonPath: (id: PackageJson) => PackageJson;
9
- resolveConfig: ResolveConfig<PackageJson>;
10
- };
11
- export default _default;
1
+ import type { Plugin } from '../../types/config.js';
2
+ declare const plugin: Plugin;
3
+ export default plugin;
@@ -18,7 +18,7 @@ const resolveConfig = localConfig => {
18
18
  }
19
19
  return [];
20
20
  };
21
- export default {
21
+ const plugin = {
22
22
  title,
23
23
  enablers,
24
24
  isEnabled,
@@ -26,3 +26,4 @@ export default {
26
26
  packageJsonPath,
27
27
  resolveConfig,
28
28
  };
29
+ export default plugin;
@@ -1,10 +1,3 @@
1
- import type { ParsedArgs } from 'minimist';
2
- declare const _default: {
3
- title: string;
4
- args: {
5
- args: (args: string[]) => string[];
6
- boolean: string[];
7
- fromArgs: (parsed: ParsedArgs, args: string[]) => string[];
8
- };
9
- };
10
- export default _default;
1
+ import type { Plugin } from '../../types/config.js';
2
+ declare const plugin: Plugin;
3
+ export default plugin;
@@ -5,7 +5,8 @@ const args = {
5
5
  boolean: ['all', 'check-coverage', 'clean', 'exclude-after-remap', 'per-file', 'skip-full'],
6
6
  fromArgs: (parsed, args) => argsFrom(args, parsed._[0]),
7
7
  };
8
- export default {
8
+ const plugin = {
9
9
  title,
10
10
  args,
11
11
  };
12
+ export default plugin;
@@ -1,10 +1,3 @@
1
- import type { IsPluginEnabled, ResolveConfig } from '../../types/config.js';
2
- import type { CapacitorConfig } from './types.js';
3
- declare const _default: {
4
- title: string;
5
- enablers: RegExp[];
6
- isEnabled: IsPluginEnabled;
7
- config: string[];
8
- resolveConfig: ResolveConfig<CapacitorConfig>;
9
- };
10
- export default _default;
1
+ import type { Plugin } from '../../types/config.js';
2
+ declare const plugin: Plugin;
3
+ export default plugin;
@@ -13,10 +13,11 @@ const resolveConfig = async (config, { configFileDir }) => {
13
13
  const ios = (await exists('ios/App/Podfile')) ? ['@capacitor/ios'] : [];
14
14
  return [...plugins, ...android, ...ios].map(id => toDependency(id));
15
15
  };
16
- export default {
16
+ const plugin = {
17
17
  title,
18
18
  enablers,
19
19
  isEnabled,
20
20
  config,
21
21
  resolveConfig,
22
22
  };
23
+ export default plugin;
@@ -1,9 +1,3 @@
1
- import type { IsPluginEnabled } from '../../types/config.js';
2
- declare const _default: {
3
- title: string;
4
- enablers: string[];
5
- isEnabled: IsPluginEnabled;
6
- isRootOnly: true;
7
- entry: string[];
8
- };
9
- export default _default;
1
+ import type { Plugin } from '../../types/config.js';
2
+ declare const plugin: Plugin;
3
+ export default plugin;
@@ -5,10 +5,11 @@ const enablers = ['changelogen'];
5
5
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
6
6
  const entry = ['package.json', ...toC12config('changelog')];
7
7
  const isRootOnly = true;
8
- export default {
8
+ const plugin = {
9
9
  title,
10
10
  enablers,
11
11
  isEnabled,
12
12
  isRootOnly,
13
13
  entry,
14
14
  };
15
+ export default plugin;
@@ -1,9 +1,3 @@
1
- import type { IsPluginEnabled } from '../../types/config.js';
2
- declare const _default: {
3
- title: string;
4
- enablers: string[];
5
- isEnabled: IsPluginEnabled;
6
- isRootOnly: true;
7
- entry: string[];
8
- };
9
- export default _default;
1
+ import type { Plugin } from '../../types/config.js';
2
+ declare const plugin: Plugin;
3
+ export default plugin;
@@ -5,10 +5,11 @@ const enablers = ['changelogithub'];
5
5
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
6
6
  const entry = ['package.json', ...toC12config('changelogithub')];
7
7
  const isRootOnly = true;
8
- export default {
8
+ const plugin = {
9
9
  title,
10
10
  enablers,
11
11
  isEnabled,
12
12
  isRootOnly,
13
13
  entry,
14
14
  };
15
+ export default plugin;
@@ -1,11 +1,3 @@
1
- import type { IsPluginEnabled, ResolveConfig } from '../../types/config.js';
2
- import type { ChangesetsConfig } from './types.js';
3
- declare const _default: {
4
- title: string;
5
- enablers: string[];
6
- isEnabled: IsPluginEnabled;
7
- isRootOnly: true;
8
- config: string[];
9
- resolveConfig: ResolveConfig<ChangesetsConfig>;
10
- };
11
- export default _default;
1
+ import type { Plugin } from '../../types/config.js';
2
+ declare const plugin: Plugin;
3
+ export default plugin;
@@ -12,7 +12,7 @@ const resolveConfig = config => {
12
12
  ? [config.changelog]
13
13
  : []).map(id => toDependency(id));
14
14
  };
15
- export default {
15
+ const plugin = {
16
16
  title,
17
17
  enablers,
18
18
  isEnabled,
@@ -20,3 +20,4 @@ export default {
20
20
  config,
21
21
  resolveConfig,
22
22
  };
23
+ export default plugin;
@@ -1,12 +1,3 @@
1
- import type { IsPluginEnabled, ResolveConfig } from '../../types/config.js';
2
- import type { CommitizenConfig } from './types.js';
3
- declare const _default: {
4
- title: string;
5
- enablers: string[];
6
- isEnabled: IsPluginEnabled;
7
- isRootOnly: true;
8
- packageJsonPath: string;
9
- config: string[];
10
- resolveConfig: ResolveConfig<CommitizenConfig>;
11
- };
12
- export default _default;
1
+ import type { Plugin } from '../../types/config.js';
2
+ declare const plugin: Plugin;
3
+ export default plugin;
@@ -9,7 +9,7 @@ const config = ['.czrc', '.cz.json', 'package.json'];
9
9
  const resolveConfig = config => {
10
10
  return config.path ? [toDependency(config.path)] : [];
11
11
  };
12
- export default {
12
+ const plugin = {
13
13
  title,
14
14
  enablers,
15
15
  isEnabled,
@@ -18,3 +18,4 @@ export default {
18
18
  config,
19
19
  resolveConfig,
20
20
  };
21
+ export default plugin;