@mocoto/mahoraga 0.14.1 → 0.14.3

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 (306) hide show
  1. package/README.md +0 -34
  2. package/dist/analysts/architects/analyst-structure.js +20 -20
  3. package/dist/analysts/architects/archetypes-custom.js +16 -19
  4. package/dist/analysts/architects/detector-archetypes.js +43 -36
  5. package/dist/analysts/architects/orchestrator-archetypes.js +3 -3
  6. package/dist/analysts/architects/signals-project-advanced.js +26 -28
  7. package/dist/analysts/architects/signals-project.js +2 -2
  8. package/dist/analysts/architects/strategist-structure.js +47 -66
  9. package/dist/analysts/azure-pipelines/analysts/analyst-azure.js +41 -35
  10. package/dist/analysts/azure-pipelines/corrections/correction-azure.js +22 -19
  11. package/dist/analysts/azure-pipelines/detectors/detector-azure-performance.js +21 -18
  12. package/dist/analysts/azure-pipelines/detectors/detector-azure-security.js +25 -20
  13. package/dist/analysts/azure-pipelines/detectors/detector-azure-structure.js +39 -40
  14. package/dist/analysts/azure-pipelines/scorers/scorer-azure.js +10 -7
  15. package/dist/analysts/circleci/analysts/analyst-circleci.js +33 -27
  16. package/dist/analysts/circleci/corrections/correction-circleci.js +22 -20
  17. package/dist/analysts/circleci/detectors/detector-circleci-performance.js +23 -19
  18. package/dist/analysts/circleci/detectors/detector-circleci-security.js +78 -82
  19. package/dist/analysts/circleci/detectors/detector-circleci-structure.js +22 -22
  20. package/dist/analysts/converters/convert-registry.js +1 -1
  21. package/dist/analysts/converters/engines/converter-gha-to-gitlab.js +17 -15
  22. package/dist/analysts/converters/index.js +1 -1
  23. package/dist/analysts/corrections/analyst-quick-fixes.js +25 -28
  24. package/dist/analysts/corrections/analyst-scoring.js +24 -21
  25. package/dist/analysts/corrections/auto-fix-engine.js +1 -1
  26. package/dist/analysts/corrections/corrector-structure.js +43 -42
  27. package/dist/analysts/corrections/fix-alias-imports.js +10 -6
  28. package/dist/analysts/corrections/fix-md-fences.js +23 -23
  29. package/dist/analysts/corrections/map-reversion.js +56 -53
  30. package/dist/analysts/corrections/pruning.js +19 -16
  31. package/dist/analysts/corrections/quick-fixes/fix-any-to-proper-type.js +57 -61
  32. package/dist/analysts/corrections/quick-fixes/fix-unknown-to-specific-type.js +30 -30
  33. package/dist/analysts/corrections/reorganize-barrels.js +13 -13
  34. package/dist/analysts/corrections/rewrite-testes-aliases.js +23 -22
  35. package/dist/analysts/corrections/scoring-shared.js +19 -18
  36. package/dist/analysts/corrections/type-safety/context-analyzer.js +15 -10
  37. package/dist/analysts/corrections/type-safety/type-analyzer.js +3 -3
  38. package/dist/analysts/corrections/type-safety/type-validator.js +4 -3
  39. package/dist/analysts/corrections/type-safety/usage-analyzer.js +39 -42
  40. package/dist/analysts/css/analysts/analyst-css.js +42 -42
  41. package/dist/analysts/css/corrections/correction-css.js +19 -11
  42. package/dist/analysts/css/detectors/detector-css-best-practices.js +129 -118
  43. package/dist/analysts/css/scorers/scorer-css.js +23 -18
  44. package/dist/analysts/css-in-js/analysts/analyst-css-in-js.js +24 -17
  45. package/dist/analysts/css-in-js/corrections/correction-css-in-js.js +31 -16
  46. package/dist/analysts/css-in-js/detectors/detector-css-in-js-best-practices.js +28 -30
  47. package/dist/analysts/css-in-js/scorers/scorer-css-in-js.js +79 -54
  48. package/dist/analysts/css-in-js/shared.js +7 -0
  49. package/dist/analysts/detectors/detector-architecture.js +91 -85
  50. package/dist/analysts/detectors/detector-bugs-ml.js +29 -27
  51. package/dist/analysts/detectors/detector-code-fragile.js +41 -36
  52. package/dist/analysts/detectors/detector-dependencies.js +5 -5
  53. package/dist/analysts/detectors/detector-duplications.js +26 -26
  54. package/dist/analysts/detectors/detector-monorepo.js +51 -45
  55. package/dist/analysts/detectors/detector-performance.js +24 -17
  56. package/dist/analysts/detectors/detector-recommendation-architecture.js +40 -36
  57. package/dist/analysts/detectors/detector-security.js +43 -42
  58. package/dist/analysts/detectors/detector-structure.js +31 -28
  59. package/dist/analysts/github-actions/analysts/analyst-github-actions.js +5 -8
  60. package/dist/analysts/github-actions/detectors/detector-workflow-accessibility.js +1 -9
  61. package/dist/analysts/github-actions/detectors/detector-workflow-structure.js +1 -4
  62. package/dist/analysts/github-actions/detectors/detector-workflow-trigger-unsafe.js +6 -5
  63. package/dist/analysts/gitlab-ci/analysts/analyst-gitlab-ci.js +2 -2
  64. package/dist/analysts/gitlab-ci/detectors/detector-gitlab-ci-structure.js +0 -3
  65. package/dist/analysts/go/analysts/analyst-best-practices.js +2 -2
  66. package/dist/analysts/go/analysts/analyst-concurrency.js +1 -1
  67. package/dist/analysts/go/analysts/analyst-security.js +1 -1
  68. package/dist/analysts/go/detectors/detector-conventions.js +1 -1
  69. package/dist/analysts/html/analysts/analyst-html.js +10 -12
  70. package/dist/analysts/html/detectors/detector-html.js +3 -3
  71. package/dist/analysts/js-ts/analysts/analyst-commands-cli.js +22 -22
  72. package/dist/analysts/js-ts/analysts/analyst-functions-long.js +5 -5
  73. package/dist/analysts/js-ts/analysts/analyst-patterns-usage.js +6 -2
  74. package/dist/analysts/js-ts/detectors/detector-anti-patterns-async.js +84 -9
  75. package/dist/analysts/js-ts/detectors/detector-constructions-syntactic.js +33 -10
  76. package/dist/analysts/js-ts/detectors/detector-context-smart.js +6 -6
  77. package/dist/analysts/js-ts/detectors/detector-leaks-memory.js +1 -1
  78. package/dist/analysts/js-ts/detectors/detector-types-unsafe.js +33 -2
  79. package/dist/analysts/php/analysts/analyst-php.js +3 -3
  80. package/dist/analysts/php/detectors/detector-php-best-practices.js +5 -5
  81. package/dist/analysts/php/detectors/detector-php-security.js +5 -5
  82. package/dist/analysts/php/scorers/scorer-php.js +2 -2
  83. package/dist/analysts/plugins/detector-documentation.js +6 -6
  84. package/dist/analysts/plugins/detector-markdown.js +7 -7
  85. package/dist/analysts/python/analysts/analyst-python.js +2 -5
  86. package/dist/analysts/react/analysts/analyst-react-hooks.js +66 -9
  87. package/dist/analysts/react/analysts/analyst-react.js +46 -2
  88. package/dist/analysts/react/corrections/correction-react.js +41 -1
  89. package/dist/analysts/react/detectors/detector-react-best-practices.js +5 -5
  90. package/dist/analysts/react/scorers/scorer-react.js +36 -1
  91. package/dist/analysts/registry/autodiscovery.js +2 -2
  92. package/dist/analysts/rust/analysts/analyst-best-practices.js +42 -3
  93. package/dist/analysts/rust/analysts/analyst-memory.js +2 -2
  94. package/dist/analysts/rust/analysts/analyst-rust.js +52 -5
  95. package/dist/analysts/rust/analysts/analyst-security.js +29 -1
  96. package/dist/analysts/scorers/scorer.js +5 -5
  97. package/dist/analysts/shell/analysts/analyst-shell.js +81 -5
  98. package/dist/analysts/shell/corrections/correction-shell.js +34 -1
  99. package/dist/analysts/shell/detectors/detector-shell-security.js +88 -0
  100. package/dist/analysts/shell/scorers/scorer-shell.js +58 -1
  101. package/dist/analysts/strategists/operator-structure.js +5 -7
  102. package/dist/analysts/strategists/suggestions-contextuais.js +5 -2
  103. package/dist/analysts/svg/analysts/analyst-svg.js +1 -0
  104. package/dist/analysts/tailwind/analysts/analyst-tailwind.js +79 -55
  105. package/dist/analysts/tailwind/corrections/correction-tailwind.js +108 -9
  106. package/dist/analysts/tailwind/detectors/detector-tailwind-best-practices.js +122 -7
  107. package/dist/analysts/tailwind/scorers/scorer-tailwind.js +62 -11
  108. package/dist/analysts/xml/analysts/analyst-xml.js +2 -2
  109. package/dist/app/index.js +1 -0
  110. package/dist/bin/cli-bootstrap.js +6 -4
  111. package/dist/bin/index.js +6 -4
  112. package/dist/caretakers/scoring.js +1 -0
  113. package/dist/cli/commands/command-analysts.js +4 -3
  114. package/dist/cli/commands/command-azure.js +1 -1
  115. package/dist/cli/commands/command-circleci.js +1 -1
  116. package/dist/cli/commands/command-compliance.js +1 -1
  117. package/dist/cli/commands/command-diagnose.js +10 -13
  118. package/dist/cli/commands/command-fix-types.js +9 -32
  119. package/dist/cli/commands/command-formatters.js +2 -2
  120. package/dist/cli/commands/command-github-actions.js +1 -1
  121. package/dist/cli/commands/command-gitlab-ci.js +1 -1
  122. package/dist/cli/commands/command-guardian.js +1 -1
  123. package/dist/cli/commands/command-imports.js +6 -6
  124. package/dist/cli/commands/command-jenkins.js +1 -1
  125. package/dist/cli/commands/command-licenses.js +1 -1
  126. package/dist/cli/commands/command-marketplace.js +7 -7
  127. package/dist/cli/commands/command-names.js +3 -8
  128. package/dist/cli/commands/command-perf.js +7 -9
  129. package/dist/cli/commands/command-plugins.js +4 -4
  130. package/dist/cli/diagnostic/auto-fix.js +2 -2
  131. package/dist/cli/diagnostic/exporters/json-exporter.js +1 -1
  132. package/dist/cli/diagnostic/exporters/sharded-exporter.js +0 -3
  133. package/dist/cli/diagnostic/exporters/svg-optimization-exporter.js +1 -1
  134. package/dist/cli/diagnostic/filters.js +9 -9
  135. package/dist/cli/diagnostic/handlers/archetype-handler.js +3 -6
  136. package/dist/cli/diagnostic/handlers/auto-fix-handler.js +4 -4
  137. package/dist/cli/diagnostic/handlers/guardian-handler.js +1 -1
  138. package/dist/cli/diagnostic/processing-diagnostic.js +31 -35
  139. package/dist/cli/diagnostic/processing-helpers.js +2 -2
  140. package/dist/cli/handlers/fix-types-exporter.js +1 -4
  141. package/dist/cli/helpers/display-frame.js +5 -5
  142. package/dist/core/config/auto/auto-fix-config.js +0 -6
  143. package/dist/core/config/chalk-safe.js +6 -6
  144. package/dist/core/config/config.js +11 -13
  145. package/dist/core/config/conventions.js +1 -1
  146. package/dist/core/config/security.js +2 -2
  147. package/dist/core/execution/analysis-cache.js +5 -8
  148. package/dist/core/execution/ast-cache.js +1 -3
  149. package/dist/core/execution/executor.js +8 -21
  150. package/dist/core/execution/inquisitor.js +24 -21
  151. package/dist/core/execution/results.js +1 -0
  152. package/dist/core/execution/scanner.js +4 -4
  153. package/dist/core/messages/en/analysts/analyst-github-actions-messages.js +1 -1
  154. package/dist/core/messages/en/analysts/analyst-patterns-usage-messages.js +1 -0
  155. package/dist/core/messages/en/analysts/analyst-shell-messages.js +15 -0
  156. package/dist/core/messages/en/analysts/detector-constructions-syntactic-messages.js +6 -0
  157. package/dist/core/messages/en/analysts/detector-js-ts-messages.js +27 -0
  158. package/dist/core/messages/en/analysts/detector-react-messages.js +8 -0
  159. package/dist/core/messages/en/analysts/detector-shell-messages.js +17 -0
  160. package/dist/core/messages/en/analysts/detector-tailwind-messages.js +3 -3
  161. package/dist/core/messages/en/analysts/report-circleci-messages.js +7 -7
  162. package/dist/core/messages/en/caretakers/caretaker-messages.js +1 -7
  163. package/dist/core/messages/en/core/plugin-messages.js +31 -3
  164. package/dist/core/messages/en/log/log.js +4 -4
  165. package/dist/core/messages/en/ui/filter-config.js +1 -5
  166. package/dist/core/messages/i18n-system.js +3 -3
  167. package/dist/core/messages/index.js +3 -3
  168. package/dist/core/messages/ja/analysts/analyst-github-actions-messages.js +1 -1
  169. package/dist/core/messages/ja/analysts/analyst-patterns-usage-messages.js +1 -0
  170. package/dist/core/messages/ja/analysts/analyst-shell-messages.js +15 -0
  171. package/dist/core/messages/ja/analysts/detector-constructions-syntactic-messages.js +6 -0
  172. package/dist/core/messages/ja/analysts/detector-js-ts-messages.js +27 -0
  173. package/dist/core/messages/ja/analysts/detector-react-messages.js +8 -0
  174. package/dist/core/messages/ja/analysts/detector-shell-messages.js +17 -0
  175. package/dist/core/messages/ja/analysts/detector-tailwind-messages.js +3 -3
  176. package/dist/core/messages/ja/analysts/report-circleci-messages.js +7 -7
  177. package/dist/core/messages/ja/caretakers/caretaker-messages.js +1 -7
  178. package/dist/core/messages/ja/core/plugin-messages.js +31 -3
  179. package/dist/core/messages/ja/log/log.js +4 -4
  180. package/dist/core/messages/ja/ui/filter-config.js +1 -1
  181. package/dist/core/messages/pt/analysts/analyst-github-actions-messages.js +1 -1
  182. package/dist/core/messages/pt/analysts/analyst-patterns-usage-messages.js +1 -0
  183. package/dist/core/messages/pt/analysts/analyst-shell-messages.js +15 -0
  184. package/dist/core/messages/pt/analysts/detector-constructions-syntactic-messages.js +6 -0
  185. package/dist/core/messages/pt/analysts/detector-js-ts-messages.js +27 -0
  186. package/dist/core/messages/pt/analysts/detector-react-messages.js +8 -0
  187. package/dist/core/messages/pt/analysts/detector-shell-messages.js +17 -0
  188. package/dist/core/messages/pt/analysts/detector-tailwind-messages.js +3 -3
  189. package/dist/core/messages/pt/analysts/report-circleci-messages.js +7 -7
  190. package/dist/core/messages/pt/caretakers/caretaker-messages.js +1 -7
  191. package/dist/core/messages/pt/core/plugin-messages.js +31 -3
  192. package/dist/core/messages/pt/log/log-engine.js +6 -6
  193. package/dist/core/messages/pt/log/log.js +3 -3
  194. package/dist/core/messages/pt/ui/filter-config.js +1 -1
  195. package/dist/core/messages/shared/icons.js +3 -3
  196. package/dist/core/messages/zh/analysts/analyst-github-actions-messages.js +1 -1
  197. package/dist/core/messages/zh/analysts/analyst-patterns-usage-messages.js +1 -0
  198. package/dist/core/messages/zh/analysts/analyst-shell-messages.js +15 -0
  199. package/dist/core/messages/zh/analysts/detector-constructions-syntactic-messages.js +6 -0
  200. package/dist/core/messages/zh/analysts/detector-js-ts-messages.js +27 -0
  201. package/dist/core/messages/zh/analysts/detector-react-messages.js +8 -0
  202. package/dist/core/messages/zh/analysts/detector-shell-messages.js +17 -0
  203. package/dist/core/messages/zh/analysts/detector-tailwind-messages.js +3 -3
  204. package/dist/core/messages/zh/analysts/report-circleci-messages.js +7 -7
  205. package/dist/core/messages/zh/caretakers/caretaker-messages.js +1 -7
  206. package/dist/core/messages/zh/core/plugin-messages.js +31 -3
  207. package/dist/core/messages/zh/log/log.js +3 -3
  208. package/dist/core/messages/zh/ui/filter-config.js +1 -5
  209. package/dist/core/parsing/filters.js +3 -3
  210. package/dist/core/parsing/langs/json.js +1 -1
  211. package/dist/core/parsing/langs/python.js +1 -1
  212. package/dist/core/parsing/langs/typescript.js +1 -1
  213. package/dist/core/parsing/parser.js +3 -4
  214. package/dist/core/parsing/utils.js +1 -0
  215. package/dist/core/registry/file-registry.js +3 -2
  216. package/dist/core/registry/paths.js +3 -3
  217. package/dist/core/reporting/default-reporter.js +2 -2
  218. package/dist/core/schema/version.js +6 -6
  219. package/dist/core/workers/worker-executor.js +3 -3
  220. package/dist/core/workers/worker-pool.js +0 -0
  221. package/dist/guardian/baseline.js +1 -1
  222. package/dist/guardian/gpg.js +3 -1
  223. package/dist/guardian/integrity.js +2 -7
  224. package/dist/guardian/records.js +7 -1
  225. package/dist/guardian/result.js +1 -1
  226. package/dist/guardian/sentinel.js +7 -1
  227. package/dist/guardian/watcher-hidden.js +6 -1
  228. package/dist/licenses/fs-utils.js +5 -1
  229. package/dist/licenses/generate-notices.js +1 -1
  230. package/dist/licenses/index.js +1 -0
  231. package/dist/licenses/normalizer.js +10 -9
  232. package/dist/node.loader.js +224 -4
  233. package/dist/reports/analise-async-patterns.js +1 -1
  234. package/dist/reports/filter-smart.js +2 -5
  235. package/dist/reports/generator-report.js +7 -7
  236. package/dist/reports/report-archetypes.js +10 -10
  237. package/dist/reports/report-caretaker-health.js +2 -1
  238. package/dist/reports/report-patterns-usage.js +1 -1
  239. package/dist/sdk/analyzer.js +1 -1
  240. package/dist/shared/data-processing/fragment-report.js +11 -11
  241. package/dist/shared/data-processing/json.js +1 -1
  242. package/dist/shared/data-processing/occurrences.js +3 -2
  243. package/dist/shared/formatters/code-min-formatter.js +1 -1
  244. package/dist/shared/formatters/engines/prettier.js +1 -1
  245. package/dist/shared/formatters/engines/stylelint.js +43 -40
  246. package/dist/shared/formatters/formatter.js +8 -8
  247. package/dist/shared/formatters/formatters/code.js +3 -3
  248. package/dist/shared/formatters/formatters/css.js +2 -10
  249. package/dist/shared/formatters/formatters/dotfiles.js +1 -1
  250. package/dist/shared/formatters/formatters/html.js +1 -5
  251. package/dist/shared/formatters/formatters/json.js +0 -3
  252. package/dist/shared/formatters/formatters/markdown.js +19 -24
  253. package/dist/shared/formatters/formatters/properties.js +2 -2
  254. package/dist/shared/formatters/formatters/shell.js +1 -4
  255. package/dist/shared/formatters/formatters/sql.js +0 -3
  256. package/dist/shared/formatters/formatters/xml.js +5 -7
  257. package/dist/shared/formatters/formatters/yaml.js +2 -7
  258. package/dist/shared/formatters/index.js +1 -1
  259. package/dist/shared/helpers/framework-detector.js +6 -2
  260. package/dist/shared/helpers/json.js +1 -1
  261. package/dist/shared/helpers/magic-constants-whitelist.js +1 -1
  262. package/dist/shared/helpers/masking.js +17 -17
  263. package/dist/shared/helpers/reader-report.js +0 -12
  264. package/dist/shared/helpers/structural-hash.js +3 -2
  265. package/dist/shared/helpers/structure.js +1 -1
  266. package/dist/shared/marketplace/registry.js +1 -1
  267. package/dist/shared/marketplace/remote.js +4 -4
  268. package/dist/shared/persistence/persistence.js +13 -6
  269. package/dist/shared/plugins/core-plugin.js +5 -1
  270. package/dist/shared/plugins/registry.js +3 -2
  271. package/dist/types/analysts/tailwind-correction.js +2 -0
  272. package/dist/types/caretakers/imports-barrel.js +1 -0
  273. package/dist/types/caretakers/index.js +4 -0
  274. package/dist/types/caretakers/map-reversion.js +1 -0
  275. package/dist/types/caretakers/pruning.js +1 -0
  276. package/dist/types/caretakers/scoring.js +1 -0
  277. package/dist/types/common/analysts.js +1 -1
  278. package/dist/types/core/config/filters.js +1 -0
  279. package/dist/types/core/config/index.js +2 -0
  280. package/dist/types/core/execution/ambiente.js +1 -0
  281. package/dist/types/core/execution/linguagens.js +1 -0
  282. package/dist/types/core/execution/parse-errors.js +1 -0
  283. package/dist/types/core/execution/results.js +1 -0
  284. package/dist/types/core/execution/structure-json.js +1 -0
  285. package/dist/types/core/index.js +1 -0
  286. package/dist/types/core/messages/index.js +1 -0
  287. package/dist/types/core/messages/log.js +1 -0
  288. package/dist/types/core/parsing/babel-narrow.js +1 -0
  289. package/dist/types/core/parsing/index.js +1 -0
  290. package/dist/types/core/runtime.js +1 -0
  291. package/dist/types/guardian/index.js +2 -0
  292. package/dist/types/guardian/integrity.js +7 -0
  293. package/dist/types/guardian/snapshot.js +1 -0
  294. package/dist/types/index.js +4 -4
  295. package/dist/types/licenses/index.js +2 -0
  296. package/dist/types/processing/display.js +16 -13
  297. package/dist/types/processing/filters.js +8 -11
  298. package/dist/types/reports/compliance.js +1 -0
  299. package/dist/types/reports/streaming.js +1 -0
  300. package/dist/types/scripts/index.js +1 -0
  301. package/dist/types/scripts/migrar-aliases.js +1 -0
  302. package/dist/types/sdk/index.js +1 -0
  303. package/dist/types/shared/index.js +2 -0
  304. package/dist/types/vulnerabilities/index.js +2 -0
  305. package/dist/vulnerabilities/scanner.js +3 -2
  306. package/package.json +14 -20
@@ -1,17 +1,35 @@
1
1
  // SPDX-License-Identifier: MIT
2
- import { splitLines } from '../../../shared/helpers/index.js';
2
+ const V3_DEPRECATED_MAP = {
3
+ 'shadow-sm': 'shadow-xs',
4
+ 'drop-shadow-sm': 'drop-shadow-xs',
5
+ 'blur-sm': 'blur-xs',
6
+ 'rounded-sm': 'rounded-xs',
7
+ 'outline-none': 'outline-hidden',
8
+ 'flex-shrink': 'shrink',
9
+ 'flex-grow': 'grow',
10
+ 'overflow-ellipsis': 'text-ellipsis',
11
+ 'decoration-slice': 'box-decoration-slice',
12
+ 'decoration-clone': 'box-decoration-clone',
13
+ };
3
14
  export function pontuarTailwind(src, _relPath) {
4
15
  let score = 0;
5
16
  const maxScore = 100;
6
17
  const issues = [];
7
18
  const strengths = [];
8
- const _linhas = splitLines(src);
9
19
  const srcCompleto = src;
10
20
  const classMatches = srcCompleto.match(/\bclass(Name)?\s*=\s*["']([^"']*)["']/g) ?? [];
11
21
  const allClasses = classMatches.map(metrica => {
12
22
  const match = metrica.match(/["']([^"']*)["']/);
13
23
  return match ? match[1].split(/\s+/).filter(Boolean) : [];
14
24
  }).flat();
25
+ const v3Deprecated = allClasses.filter(c => c in V3_DEPRECATED_MAP);
26
+ if (v3Deprecated.length === 0) {
27
+ score += 5;
28
+ strengths.push('Sem classes obsoletas do v3');
29
+ }
30
+ else {
31
+ issues.push(`${v3Deprecated.length} classe(s) obsoleta(s) do v3 detectadas: ${v3Deprecated.map(c => `${c}→${V3_DEPRECATED_MAP[c]}`).join(', ')}`);
32
+ }
15
33
  const duplicates = allClasses.filter((elem, indice) => allClasses.indexOf(elem) !== indice);
16
34
  if (duplicates.length === 0) {
17
35
  score += 10;
@@ -55,7 +73,7 @@ export function pontuarTailwind(src, _relPath) {
55
73
  }
56
74
  else {
57
75
  score += 2;
58
- issues.push(`${arbitraryValues.length} valores arbitrários - considere tailwind.config.js`);
76
+ issues.push(`${arbitraryValues.length} valores arbitrários - considere @theme no CSS`);
59
77
  }
60
78
  const importantCount = (srcCompleto.match(/class(Name)?=.*!/g) ?? []).length;
61
79
  if (importantCount === 0) {
@@ -123,15 +141,48 @@ export function pontuarTailwind(src, _relPath) {
123
141
  else {
124
142
  issues.push(`Média de ${avgClasses.toFixed(1)} classes por elemento - considere extrair componentes`);
125
143
  }
126
- const customCssPatterns = (srcCompleto.match(/@apply|@layer|@tailwind/g) ?? []).length;
127
- if (customCssPatterns > 0) {
144
+ const hasThemeDirective = /@theme\b/.test(srcCompleto);
145
+ const hasConfigRef = /\btailwind\.config|\b@config\b/.test(srcCompleto);
146
+ if (hasThemeDirective) {
128
147
  score += 5;
129
- strengths.push('Uso de @apply para estilos customizados');
148
+ strengths.push('Uso de @theme para design tokens (v4)');
130
149
  }
131
- const designTokensInConfig = /\btailwind\.config/.test(srcCompleto);
132
- if (designTokensInConfig) {
133
- score += 5;
134
- strengths.push('Design tokens configurados');
150
+ else if (hasConfigRef) {
151
+ score += 2;
152
+ issues.push('Use @theme no CSS ao invés de tailwind.config.js (v4)');
153
+ }
154
+ else {
155
+ score += 3;
156
+ }
157
+ const hasImportTailwindcss = /@import\s+["']tailwindcss["']/.test(srcCompleto);
158
+ const hasTailwindDirective = /@tailwind\s+(base|components|utilities)/.test(srcCompleto);
159
+ if (hasImportTailwindcss) {
160
+ score += 3;
161
+ strengths.push('Importa Tailwind via @import "tailwindcss" (v4)');
162
+ }
163
+ else if (hasTailwindDirective) {
164
+ issues.push('Use @import "tailwindcss" ao invés de @tailwind (v4)');
165
+ }
166
+ const hasUtilityDirective = /@utility\b/.test(srcCompleto);
167
+ const hasLayerUtilities = /@layer\s+utilities/.test(srcCompleto);
168
+ if (hasUtilityDirective) {
169
+ score += 4;
170
+ strengths.push('Uso de @utility para custom utilities (v4)');
171
+ }
172
+ else if (hasLayerUtilities) {
173
+ issues.push('Use @utility ao invés de @layer utilities (v4)');
174
+ }
175
+ const v3ImportantPrefix = (srcCompleto.match(/class(Name)?\s*=\s*["'][^"']*![\w-]/g) ?? []).length;
176
+ if (v3ImportantPrefix > 0) {
177
+ issues.push(`${v3ImportantPrefix} uso(s) de ! como prefixo (v3) - mova ! para o final (ex: flex! no lugar de !flex)`);
178
+ }
179
+ const v3VariableArbitrary = (srcCompleto.match(/\[--[^\]]+\]/g) ?? []).length;
180
+ if (v3VariableArbitrary > 0) {
181
+ issues.push(`${v3VariableArbitrary} variável(is) em colchetes - use bg-(--var) ao invés de bg-[--var] (v4)`);
182
+ }
183
+ const themeFunction = (srcCompleto.match(/\btheme\(/g) ?? []).length;
184
+ if (themeFunction > 0) {
185
+ issues.push(`${themeFunction} uso(s) de theme() - prefira CSS variables (var(--color-*)) (v4)`);
135
186
  }
136
187
  return {
137
188
  score: Math.min(score, maxScore),
@@ -144,6 +195,6 @@ export function pontuarTailwind(src, _relPath) {
144
195
  export const pontuadorTailwind = {
145
196
  nome: 'pontuador-tailwind',
146
197
  categoria: 'estilo',
147
- descricao: 'Pontua qualidade de Tailwind CSS',
198
+ descricao: 'Pontua qualidade de Tailwind CSS v4',
148
199
  pontuar: pontuarTailwind
149
200
  };
@@ -147,7 +147,7 @@ function collectXmlIssues(src, relPath) {
147
147
  }
148
148
  // DOCTYPE + ENTITY (XXE)
149
149
  for (const metrica of scan.matchAll(/<!DOCTYPE\b[\s\S]*?(?:\]\s*>|>)/gi)) {
150
- const chunk = metrica[0] ?? '';
150
+ const chunk = metrica[0];
151
151
  const hasExternalId = /\b(SYSTEM|PUBLIC)\b/i.test(chunk);
152
152
  const line = lineOf(metrica.index);
153
153
  ocorrencias.push(warn(messages.XmlMensagens.doctypeDetectado, relPath, line));
@@ -156,7 +156,7 @@ function collectXmlIssues(src, relPath) {
156
156
  }
157
157
  }
158
158
  for (const metrica of scan.matchAll(/<!ENTITY\b[\s\S]*?>/gi)) {
159
- const chunk = metrica[0] ?? '';
159
+ const chunk = metrica[0];
160
160
  const hasExternal = /\b(SYSTEM|PUBLIC)\b/i.test(chunk);
161
161
  const isParamEntity = /<!ENTITY\s+%/i.test(chunk);
162
162
  const line = lineOf(metrica.index);
@@ -0,0 +1 @@
1
+ export * from './github.js';
@@ -35,9 +35,11 @@ async function registrarLoader() {
35
35
  const loaderCaminho = resolvePath(distRaiz, 'node.loader.js');
36
36
  const loaderUrl = pathToFileURL(loaderCaminho).toString();
37
37
  // Tenta registrar o loader via API experimental da v20+
38
- const { register } = await import('node:module');
39
- if (typeof register === 'function') {
40
- register(loaderUrl, pathToFileURL('./'));
38
+ const moduleImport = await import('node:module');
39
+ const registerHooks = moduleImport.registerHooks;
40
+ if (typeof registerHooks === 'function') {
41
+ const hooks = await import(loaderUrl);
42
+ registerHooks(hooks);
41
43
  }
42
44
  }
43
45
  catch (err) {
@@ -170,7 +172,7 @@ export async function mainCli() {
170
172
  log.debug(CliBinMensagens.erroInicializarFormatadores.replace('{erro}', err instanceof Error ? err.message : String(err)));
171
173
  }
172
174
  // 4. Registro de Comandos
173
- registrarComandos(program, ocorrencia => aplicarFlagsGlobais(ocorrencia));
175
+ registrarComandos(program, ocorrencia => void aplicarFlagsGlobais(ocorrencia));
174
176
  program.addCommand(comandoPerf());
175
177
  // 5. Flags de histórico
176
178
  const argv = process.argv.slice(2);
package/dist/bin/index.js CHANGED
@@ -35,9 +35,11 @@ async function registrarLoader() {
35
35
  const loaderCaminho = resolvePath(distRaiz, 'node.loader.js');
36
36
  const loaderUrl = pathToFileURL(loaderCaminho).toString();
37
37
  // Tenta registrar o loader via API experimental da v20+
38
- const { register } = await import('node:module');
39
- if (typeof register === 'function') {
40
- register(loaderUrl, pathToFileURL('./'));
38
+ const moduleImport = await import('node:module');
39
+ const registerHooks = moduleImport.registerHooks;
40
+ if (typeof registerHooks === 'function') {
41
+ const hooks = await import(loaderUrl);
42
+ registerHooks(hooks);
41
43
  }
42
44
  }
43
45
  catch (err) {
@@ -170,7 +172,7 @@ export async function mainCli() {
170
172
  log.debug(CliBinMensagens.erroInicializarFormatadores.replace('{erro}', err instanceof Error ? err.message : String(err)));
171
173
  }
172
174
  // 4. Registro de Comandos
173
- registrarComandos(program, ocorrencia => aplicarFlagsGlobais(ocorrencia));
175
+ registrarComandos(program, ocorrencia => void aplicarFlagsGlobais(ocorrencia));
174
176
  program.addCommand(comandoPerf());
175
177
  // 5. Flags de histórico
176
178
  const argv = process.argv.slice(2);
@@ -1 +1,2 @@
1
+ // Tipos mínimos para o zelador de pontuação
1
2
  export {};
@@ -40,8 +40,9 @@ export function comandoAnalistas() {
40
40
  for (const arquivo of lista) {
41
41
  const registroOriginal = registroAnalistas.find(raiz => raiz.nome === arquivo.nome);
42
42
  let limitesStr = '';
43
- if (registroOriginal?.limites) {
44
- limitesStr = Object.entries(registroOriginal.limites).map(([chave, valor]) => `${chave}:${valor}`).join('<br>');
43
+ if (registroOriginal && 'limites' in registroOriginal && registroOriginal.limites) {
44
+ const limites = registroOriginal.limites;
45
+ limitesStr = Object.entries(limites).map(([chave, valor]) => `${chave}:${String(valor)}`).join('<br>');
45
46
  }
46
47
  linhas.push(messages.CliComandoAnalistasMensagens.docLinhaAnalista(arquivo.nome, arquivo.categoria, arquivo.descricao || '', limitesStr));
47
48
  }
@@ -56,7 +57,7 @@ export function comandoAnalistas() {
56
57
  geradoEm: new Date().toISOString(),
57
58
  total: lista.length,
58
59
  analistas: lista,
59
- configLimites: config.ANALISE_LIMITES ?? {}
60
+ configLimites: config.ANALISE_LIMITES
60
61
  });
61
62
  log.sucesso(messages.CliComandoAnalistasMensagens.jsonExportado(destino));
62
63
  return;
@@ -73,7 +73,7 @@ export function comandoAzure() {
73
73
  console.log('');
74
74
  ocorrencias.forEach((ocorrencia) => {
75
75
  const prefix = ocorrencia.nivel === 'erro' ? '[RED]' : ocorrencia.nivel === 'aviso' ? '[YELLOW]' : '[BLUE]';
76
- log.info(msgs.ocorrencia(prefix, ocorrencia.tipo ?? '', ocorrencia.linha ?? 0, ocorrencia.mensagem ?? ''));
76
+ log.info(msgs.ocorrencia(prefix, ocorrencia.tipo ?? '', ocorrencia.linha ?? 0, ocorrencia.mensagem));
77
77
  if (ocorrencia.sugestao) {
78
78
  log.info(msgs.sugestao(ocorrencia.sugestao));
79
79
  }
@@ -69,7 +69,7 @@ export function comandoCircleCI() {
69
69
  console.log('');
70
70
  ocorrencias.forEach(ocorrencia => {
71
71
  const prefix = ocorrencia.nivel === 'erro' ? '[RED]' : ocorrencia.nivel === 'aviso' ? '[YELLOW]' : '[BLUE]';
72
- log.info(msgs.ocorrencia(prefix, ocorrencia.tipo ?? '', ocorrencia.linha ?? 0, ocorrencia.mensagem ?? ''));
72
+ log.info(msgs.ocorrencia(prefix, ocorrencia.tipo ?? '', ocorrencia.linha ?? 0, ocorrencia.mensagem));
73
73
  if (ocorrencia.sugestao) {
74
74
  log.info(msgs.sugestao(ocorrencia.sugestao));
75
75
  }
@@ -28,7 +28,7 @@ export function comandoCompliance() {
28
28
  }
29
29
  const { processarDiagnostico } = await import('../diagnostic/index.js');
30
30
  const resultado = await processarDiagnostico({ json: true });
31
- const ocorrencias = resultado.resultadoFinal.ocorrencias ?? [];
31
+ const ocorrencias = resultado.resultadoFinal.ocorrencias;
32
32
  const relatorio = gerarRelatorioCompliance(framework, ocorrencias, {
33
33
  nomeProjeto: process.cwd().split('/').pop() ?? 'projeto',
34
34
  duracao: resultado.resultadoFinal.metricas.tempoTotal ?? 0,
@@ -44,10 +44,6 @@ async function mostrarSugestoesVerbose(opts, command, logNivel) {
44
44
  const activeFlags = [];
45
45
  const details = [];
46
46
  const parentOpts = obterOptsParent(command);
47
- if (json) {
48
- activeFlags.push('--json');
49
- details.push(messages.CliComandoDiagnosticarMensagens.detalheSaidaEstruturada);
50
- }
51
47
  if (Boolean(opts['guardianCheck'])) {
52
48
  activeFlags.push('--guardian-check');
53
49
  details.push(messages.CliComandoDiagnosticarMensagens.detalheGuardian);
@@ -81,28 +77,29 @@ async function mostrarSugestoesVerbose(opts, command, logNivel) {
81
77
  activeFlags.push('--auto-fix-conservative');
82
78
  details.push(messages.CliComandoDiagnosticarMensagens.detalheAutoFixConservative);
83
79
  }
84
- const includes = opts['include'] || [];
85
- const excludes = opts['exclude'] || [];
80
+ const includes = opts['include'];
81
+ const excludes = opts['exclude'];
86
82
  if (includes.length) {
87
83
  details.push(messages.CliComandoDiagnosticarMensagens.detalheIncludePatterns(includes.length, includes.join(', ')));
88
84
  }
89
85
  if (excludes.length) {
90
86
  details.push(messages.CliComandoDiagnosticarMensagens.detalheExcludePatterns(excludes.length, excludes.join(', ')));
91
87
  }
92
- const parentExport = (parentOpts && Object.prototype.hasOwnProperty.call(parentOpts, 'export') && Boolean(parentOpts['export']));
93
- const parentExportFull = (parentOpts && Object.prototype.hasOwnProperty.call(parentOpts, 'exportFull') && Boolean(parentOpts['exportFull']));
88
+ const parentExport = (Object.prototype.hasOwnProperty.call(parentOpts, 'export') && Boolean(parentOpts['export']));
89
+ const parentExportFull = (Object.prototype.hasOwnProperty.call(parentOpts, 'exportFull') && Boolean(parentOpts['exportFull']));
94
90
  const localExport = Boolean(opts['export']);
95
91
  const localExportFull = Boolean(opts['exportFull']);
96
92
  if (parentExport || localExport) {
97
93
  activeFlags.push('--export');
98
- const relDir = config && (config['REPORTS_DIR'] ?? 'reports');
99
- details.push(messages.CliComandoDiagnosticarMensagens.detalheExport(String(relDir)));
94
+ const relDirValue = config?.['REPORTS_DIR'];
95
+ const relDir = typeof relDirValue === 'string' ? relDirValue : 'reports';
96
+ details.push(messages.CliComandoDiagnosticarMensagens.detalheExport(relDir));
100
97
  }
101
98
  if (parentExportFull || localExportFull) {
102
99
  activeFlags.push('--export-full');
103
100
  details.push(messages.CliComandoDiagnosticarMensagens.detalheExportFull);
104
101
  }
105
- const resolvedParentLogNivel = parentOpts && Object.prototype.hasOwnProperty.call(parentOpts, 'logLevel') ? String(parentOpts['logLevel']) : undefined;
102
+ const resolvedParentLogNivel = Object.prototype.hasOwnProperty.call(parentOpts, 'logLevel') ? String(parentOpts['logLevel']) : undefined;
106
103
  const effectiveLogNivel = logNivel || (resolvedParentLogNivel ?? 'info');
107
104
  details.push(messages.CliComandoDiagnosticarMensagens.detalheLogLevel(effectiveLogNivel));
108
105
  details.push(messages.CliComandoDiagnosticarMensagens.dicaPrefiraLogLevelDebug);
@@ -151,7 +148,7 @@ export function comandoDiagnosticar(aplicarFlagsGlobais) {
151
148
  cmd.allowUnknownOption(true);
152
149
  cmd.allowExcessArguments(true);
153
150
  for (const opt of optionsDiagnosticar) {
154
- if ('parser' in opt && opt.parser) {
151
+ if ('parser' in opt) {
155
152
  cmd.option(opt.flags, opt.desc, opt.parser, opt.defaultValue);
156
153
  }
157
154
  else if ('defaultValue' in opt) {
@@ -162,7 +159,7 @@ export function comandoDiagnosticar(aplicarFlagsGlobais) {
162
159
  }
163
160
  }
164
161
  cmd.action(async (opts, command) => {
165
- await aplicarFlagsCombinadas(command, opts, aplicarFlagsGlobais);
162
+ aplicarFlagsCombinadas(command, opts, aplicarFlagsGlobais);
166
163
  if (process.env.SUKUNA_TEST_FAST === '1') {
167
164
  if (opts.json) {
168
165
  console.log(JSON.stringify({
@@ -8,7 +8,7 @@ import { PROJETO_RAIZ } from '../../core/registry/index.js';
8
8
  import { exportarRelatoriosFixTypes } from '../handlers/index.js';
9
9
  import { ExitCode, expandIncludePatterns, processPatternList, sair } from '../helpers/index.js';
10
10
  import { asTecnicas, extrairMensagemErro } from '../../types/index.js';
11
- const { CliComandoFixTypesMensagens, DICAS, formatarTipoInseguro, gerarResumoCategoria, ICONES_FIX_TYPES: ICONES, log, MENSAGENS_AUTOFIX, MENSAGENS_CLI_CORRECAO_TIPOS, MENSAGENS_ERRO_FIX_TYPES: MENSAGENS_ERRO, MENSAGENS_INICIO_FIX_TYPES: MENSAGENS_INICIO, MENSAGENS_PROGRESSO_FIX_TYPES: MENSAGENS_PROGRESSO, MENSAGENS_RESUMO, MENSAGENS_SUCESSO_FIX_TYPES: MENSAGENS_SUCESSO, TEMPLATE_RESUMO_FINAL, TEXTOS_CATEGORIZACAO_CORRECAO_TIPOS, } = getMessages();
11
+ const { CliComandoFixTypesMensagens, DICAS, formatarTipoInseguro, gerarResumoCategoria, log, MENSAGENS_AUTOFIX, MENSAGENS_CLI_CORRECAO_TIPOS, MENSAGENS_ERRO_FIX_TYPES: MENSAGENS_ERRO, MENSAGENS_INICIO_FIX_TYPES: MENSAGENS_INICIO, MENSAGENS_PROGRESSO_FIX_TYPES: MENSAGENS_PROGRESSO, MENSAGENS_RESUMO, MENSAGENS_SUCESSO_FIX_TYPES: MENSAGENS_SUCESSO, TEXTOS_CATEGORIZACAO_CORRECAO_TIPOS, } = getMessages();
12
12
  function mostrarErroDev(err) {
13
13
  if (!config.DEV_MODE) {
14
14
  return;
@@ -24,8 +24,8 @@ async function carregarInquisicao() {
24
24
  const modInq = await import('../../core/execution/index.js');
25
25
  const modReg = await import('../../analysts/registry/index.js');
26
26
  registroAnalistasCache = modReg.registroAnalistas;
27
- const analistaTiposInseguros = registroAnalistasCache.find((arquivo) => {
28
- return typeof arquivo === 'object' && arquivo !== null && arquivo.nome === 'detector-tipos-inseguros';
27
+ const analistaTiposInseguros = registroAnalistasCache?.find((arquivo) => {
28
+ return typeof arquivo === 'object' && arquivo.nome === 'detector-tipos-inseguros';
29
29
  });
30
30
  return {
31
31
  iniciarInquisicao: modInq.iniciarInquisicao,
@@ -210,12 +210,12 @@ async function aplicarCorrecoesAutomaticas(ocorrenciasCategorizadas, verbose) {
210
210
  const porArquivo = {};
211
211
  for (const item of ocorrenciasCategorizadas) {
212
212
  const arquivo = item.ocorrencia.relPath || 'desconhecido';
213
- if (!porArquivo[arquivo]) {
213
+ if (!(arquivo in porArquivo)) {
214
214
  porArquivo[arquivo] = [];
215
215
  }
216
216
  porArquivo[arquivo].push(item);
217
217
  }
218
- const resultado = await aplicarCorrecoesEmLote(porArquivo, {
218
+ const resultado = aplicarCorrecoesEmLote(porArquivo, {
219
219
  dryRun: false,
220
220
  minConfianca: 85,
221
221
  verbose,
@@ -273,17 +273,6 @@ function mostrarExemplosDryRun(tiposInseguros, verbose, minConfidence) {
273
273
  log.info(DICAS.usarInterativo);
274
274
  log.info(DICAS.ajustarConfianca(minConfidence));
275
275
  }
276
- function mostrarMensagemDryRun() {
277
- console.log();
278
- log.aviso(MENSAGENS_CLI_CORRECAO_TIPOS.dryRunAviso(ICONES.inicio));
279
- log.info(MENSAGENS_CLI_CORRECAO_TIPOS.linhaEmBranco);
280
- log.info(TEMPLATE_RESUMO_FINAL.titulo);
281
- for (const passo of TEMPLATE_RESUMO_FINAL.passos) {
282
- log.info(MENSAGENS_CLI_CORRECAO_TIPOS.templatePasso(passo));
283
- }
284
- log.info(MENSAGENS_CLI_CORRECAO_TIPOS.linhaEmBranco);
285
- log.info(MENSAGENS_AUTOFIX.dicas.removerDryRun);
286
- }
287
276
  export function criarComandoFixTypes() {
288
277
  const cmd = new Command('fix-types');
289
278
  cmd.description(CliComandoFixTypesMensagens.descricao).option('--dry-run', 'Mostra o que seria corrigido sem aplicar mudanças', false).option('--target <path>', 'Diretório ou arquivo específico para analisar', 'src').option('--confidence <number>', 'Nível mínimo de confiança para aplicar correções (0-100)', '85').option('--verbose', 'Mostra detalhes de cada correção', false).option('--interactive', 'Modo interativo: confirma cada correção', false).option('--export', 'Exporta relatórios JSON e Markdown para pasta relatorios/', false).option('--include <padrao>', 'Glob pattern a INCLUIR (pode repetir a flag ou usar vírgulas / espaços para múltiplos)', (val, prev) => {
@@ -342,7 +331,7 @@ async function executarFixTypes(options) {
342
331
  sair(ExitCode.Failure);
343
332
  return;
344
333
  }
345
- const ocorrencias = resultado.ocorrencias || [];
334
+ const ocorrencias = resultado.ocorrencias;
346
335
  const tiposInseguros = ocorrencias.filter((ocorrencia) => ocorrencia.tipo && ['tipo-inseguro-any', 'tipo-inseguro-any-assertion', 'tipo-inseguro-any-cast', 'tipo-inseguro-unknown'].includes(ocorrencia.tipo));
347
336
  if (tiposInseguros.length === 0) {
348
337
  log.sucesso(MENSAGENS_SUCESSO.nenhumTipoInseguro);
@@ -351,7 +340,7 @@ async function executarFixTypes(options) {
351
340
  log.aviso(MENSAGENS_RESUMO.encontrados(tiposInseguros.length));
352
341
  const porTipo = tiposInseguros.reduce((acc, ocorrencia) => {
353
342
  const tipo = ocorrencia.tipo ?? 'desconhecido';
354
- if (!acc[tipo]) {
343
+ if (!(tipo in acc)) {
355
344
  acc[tipo] = [];
356
345
  }
357
346
  acc[tipo].push(ocorrencia);
@@ -367,15 +356,9 @@ async function executarFixTypes(options) {
367
356
  return;
368
357
  }
369
358
  log.fase(MENSAGENS_CLI_CORRECAO_TIPOS.aplicandoCorrecoesAuto);
370
- const { fixAnyToProperTipo, fixUnknownToSpecificTipo } = await import('../../analysts/corrections/quick-fixes/index.js');
371
- if (!fixAnyToProperTipo || !fixUnknownToSpecificTipo) {
372
- log.erro(MENSAGENS_ERRO.modulosNaoEncontrados);
373
- sair(ExitCode.Failure);
374
- return;
375
- }
376
359
  const porArquivo = tiposInseguros.reduce((acc, ocorrencia) => {
377
360
  const arquivo = ocorrencia.relPath || 'desconhecido';
378
- if (!acc[arquivo]) {
361
+ if (!(arquivo in acc)) {
379
362
  acc[arquivo] = [];
380
363
  }
381
364
  acc[arquivo].push(ocorrencia);
@@ -395,9 +378,6 @@ async function executarFixTypes(options) {
395
378
  if (casosAltaPrioridade.length > 0) {
396
379
  await aplicarCorrecoesAutomaticas(ocorrenciasCategorizadas, verbose);
397
380
  }
398
- else if (isDryRun) {
399
- mostrarMensagemDryRun();
400
- }
401
381
  else {
402
382
  console.log();
403
383
  log.info(MENSAGENS_SUCESSO.nenhumAltaConfianca);
@@ -423,10 +403,7 @@ async function executarFixTypes(options) {
423
403
  verbose
424
404
  });
425
405
  }
426
- const temAny = porTipo['tipo-inseguro-any'].length > 0;
427
- if (temAny && !isDryRun) {
428
- sair(ExitCode.Failure);
429
- }
406
+ sair(ExitCode.Failure);
430
407
  }
431
408
  async function salvarAnaliseDetalhada(ocorrenciasCategorizadas, stats, mediaConfianca, verbose) {
432
409
  if (!verbose) {
@@ -48,11 +48,11 @@ export function comandoFormatters() {
48
48
  return;
49
49
  }
50
50
  const mod = await import(caminhoResolvido);
51
- if (!mod.default || typeof mod.default.gerar !== 'function') {
51
+ if (typeof mod.default.gerar !== 'function') {
52
52
  log.erro(FormattersMensagens.moduloInvalido(caminho));
53
53
  return;
54
54
  }
55
- const formatter = { nome, ...mod.default };
55
+ const formatter = { nome, ...mod.default, descricao: mod.default.descricao ?? '', formato: mod.default.formato ?? 'json' };
56
56
  registrarFormatter(formatter);
57
57
  log.sucesso(FormattersMensagens.formatadorRegistrado(nome));
58
58
  }
@@ -220,7 +220,7 @@ export function comandoGithubActions() {
220
220
  sair(ExitCode.Failure);
221
221
  return;
222
222
  }
223
- const formato = opts.format;
223
+ const formato = (opts.format ?? 'json');
224
224
  if (!['json', 'markdown', 'html', 'csv'].includes(formato)) {
225
225
  log.erro(CliComandoGithubActionsMensagens.formatoInvalido(formato));
226
226
  sair(ExitCode.Failure);
@@ -69,7 +69,7 @@ export function comandoGitlabCI() {
69
69
  console.log('');
70
70
  ocorrencias.forEach(ocorrencia => {
71
71
  const prefix = ocorrencia.nivel === 'erro' ? '[RED]' : ocorrencia.nivel === 'aviso' ? '[YELLOW]' : '[BLUE]';
72
- log.info(msgs.ocorrencia(prefix, ocorrencia.tipo ?? '', ocorrencia.linha ?? 0, ocorrencia.mensagem ?? ''));
72
+ log.info(msgs.ocorrencia(prefix, ocorrencia.tipo ?? '', ocorrencia.linha ?? 0, ocorrencia.mensagem));
73
73
  if (ocorrencia.sugestao) {
74
74
  log.info(msgs.sugestao(ocorrencia.sugestao));
75
75
  }
@@ -167,7 +167,7 @@ export function comandoGuardian(aplicarFlagsGlobais) {
167
167
  }
168
168
  }
169
169
  catch (err) {
170
- logGuardian.erroGuardian(err.message ?? String(err));
170
+ logGuardian.erroGuardian(err instanceof Error ? err.message : String(err));
171
171
  mostrarErroDev(err);
172
172
  if (opts.json) {
173
173
  console.log(JSON.stringify({ status: 'erro', mensagem: extrairMensagemErro(err) }));
@@ -156,13 +156,13 @@ function analisarDiferencas(pathsAtuais, pathsPropostos) {
156
156
  const entradasPropostas = analisarTsconfigPaths(pathsPropostos);
157
157
  const entradasRemovidas = [];
158
158
  for (const entrada of entradasAtuais) {
159
- if (!pathsPropostos[entrada.alias]) {
159
+ if (!(entrada.alias in pathsPropostos)) {
160
160
  entradasRemovidas.push(entrada);
161
161
  }
162
162
  }
163
163
  const entradasNovas = [];
164
164
  for (const [alias, targets] of Object.entries(pathsPropostos)) {
165
- if (!pathsAtuais[alias]) {
165
+ if (!(alias in pathsAtuais)) {
166
166
  entradasNovas.push({
167
167
  alias,
168
168
  targets,
@@ -253,14 +253,14 @@ async function aplicarImports(projectRoot, srcDir, paths) {
253
253
  }
254
254
  if (importPath.startsWith('@')) {
255
255
  let barrelAlias = importToRewrite;
256
- if (paths[importToRewrite]) {
256
+ if (importToRewrite in paths) {
257
257
  barrelAlias = importToRewrite;
258
258
  }
259
259
  else {
260
260
  const lastSlash = importToRewrite.lastIndexOf('/');
261
261
  if (lastSlash > 0) {
262
262
  const potentialBarrel = importToRewrite.substring(0, lastSlash);
263
- if (paths[potentialBarrel]) {
263
+ if (potentialBarrel in paths) {
264
264
  barrelAlias = potentialBarrel;
265
265
  }
266
266
  }
@@ -304,7 +304,7 @@ async function aplicarImports(projectRoot, srcDir, paths) {
304
304
  if (mesmoModuloPai(srcDir, arquivo, importToRewrite)) {
305
305
  break;
306
306
  }
307
- if (paths[novoImport] && novoImport !== importPath) {
307
+ if (novoImport !== importPath && paths[novoImport]) {
308
308
  const regexResult = criarRegexImport(importPath, importToRewrite, line);
309
309
  if (regexResult) {
310
310
  lines[indice] = line.replace(regexResult, `$1$2${novoImport}$2`);
@@ -312,7 +312,7 @@ async function aplicarImports(projectRoot, srcDir, paths) {
312
312
  modified = true;
313
313
  }
314
314
  }
315
- else if (!paths[novoImport]) {
315
+ else {
316
316
  const aliasDoPai = obterAliasPaiComBarrel(srcDir, relativeToSrc, aliasMap);
317
317
  if (aliasDoPai && aliasDoPai !== importPath) {
318
318
  const regexResult = criarRegexImport(importPath, importToRewrite, line);
@@ -64,7 +64,7 @@ export function comandoJenkins() {
64
64
  console.log('');
65
65
  ocorrencias.forEach((ocorrencia) => {
66
66
  const prefix = ocorrencia.nivel === 'erro' ? '[RED]' : ocorrencia.nivel === 'aviso' ? '[YELLOW]' : '[BLUE]';
67
- log.info(msgs.ocorrencia(prefix, ocorrencia.tipo ?? '', ocorrencia.linha ?? 0, ocorrencia.mensagem ?? ''));
67
+ log.info(msgs.ocorrencia(prefix, ocorrencia.tipo ?? '', ocorrencia.linha ?? 0, ocorrencia.mensagem));
68
68
  if (ocorrencia.sugestao) {
69
69
  log.info(msgs.sugestao(ocorrencia.sugestao));
70
70
  }
@@ -21,7 +21,7 @@ export function comandoLicencas() {
21
21
  root
22
22
  });
23
23
  console.log(JSON.stringify(result, null, 2));
24
- process.exitCode = result.problematic && result.problematic.length > 0 ? 2 : 0;
24
+ process.exitCode = result.problematic.length > 0 ? 2 : 0;
25
25
  }
26
26
  catch (err) {
27
27
  log.erro(msgs.falhaScan(err instanceof Error ? err.message : String(err)));
@@ -2,7 +2,7 @@
2
2
  import { Command } from 'commander';
3
3
  import { messages } from '../../core/messages/index.js';
4
4
  import { ExitCode, sair } from '../helpers/index.js';
5
- import { buscarPacotesInstalados, info as remoteInfo, instalarPacote, listarPacotesInstalados, obterInfoPacote, removerPacote, resolverMelhorVersao, search as remoteSearch } from '../../shared/marketplace/index.js';
5
+ import { buscarPacotesInstalados, info, instalarPacote, listarPacotesInstalados, obterInfoPacote, removerPacote, resolverMelhorVersao, search } from '../../shared/marketplace/index.js';
6
6
  const log = messages.log;
7
7
  const msgs = messages.CliComandoMarketplaceMensagens;
8
8
  export function comandoMarketplace() {
@@ -15,7 +15,7 @@ export function comandoMarketplace() {
15
15
  .action(async (termo, opts) => {
16
16
  try {
17
17
  log.info(msgs.buscando(termo));
18
- const { total, resultados } = await remoteSearch(termo);
18
+ const { total, resultados } = await search(termo);
19
19
  if (opts.json) {
20
20
  console.log(JSON.stringify({ total, resultados }, null, 2));
21
21
  return;
@@ -26,8 +26,8 @@ export function comandoMarketplace() {
26
26
  }
27
27
  log.info(msgs.tituloBusca);
28
28
  for (const r of resultados) {
29
- const desc = r.descricao || msgs.semDescricao;
30
- const tags = r.tags || [];
29
+ const desc = r.descricao;
30
+ const tags = r.tags;
31
31
  log.info(msgs.itemBusca(r.nome, desc, tags));
32
32
  }
33
33
  log.info(msgs.totalResultados(total));
@@ -48,7 +48,7 @@ export function comandoMarketplace() {
48
48
  log.info(msgs.jaInstalado(nome, instalado.versao));
49
49
  return;
50
50
  }
51
- const analista = await remoteInfo(nome);
51
+ const analista = await info(nome);
52
52
  if (!analista) {
53
53
  log.erro(msgs.analistaNaoEncontrado(nome));
54
54
  sair(ExitCode.Failure);
@@ -122,7 +122,7 @@ export function comandoMarketplace() {
122
122
  .option('--json', msgs.jsonDescricao)
123
123
  .action(async (nome, opts) => {
124
124
  try {
125
- const analista = await remoteInfo(nome);
125
+ const analista = await info(nome);
126
126
  const local = await obterInfoPacote(nome);
127
127
  if (!analista && !local) {
128
128
  log.erro(msgs.analistaNaoEncontrado(nome));
@@ -148,7 +148,7 @@ export function comandoMarketplace() {
148
148
  }
149
149
  if (analista) {
150
150
  const versoes = analista.versoes.map((v) => v.version).join(', ');
151
- const tags = analista.tags || [];
151
+ const tags = analista.tags;
152
152
  log.info(msgs.infoTitulo(nome));
153
153
  log.info(msgs.infoDescricaoDetalhada(analista.descricao));
154
154
  log.info(msgs.infoCategoria(analista.categoria));
@@ -1,7 +1,7 @@
1
1
  // SPDX-License-Identifier: MIT
2
- import generateModule from '@babel/generator';
2
+ import generate from '@babel/generator';
3
3
  import { parse } from '@babel/parser';
4
- import traverseModule from '@babel/traverse';
4
+ import traverse from '@babel/traverse';
5
5
  import { Command } from 'commander';
6
6
  import * as fs from 'fs';
7
7
  import * as path from 'path';
@@ -9,12 +9,6 @@ import { chalk, config } from '../../core/config/index.js';
9
9
  import { getMessages } from '../../core/messages/index.js';
10
10
  import { ExitCode, getFilesWithExtension, getSourceFiles, sair } from '../helpers/index.js';
11
11
  const { log, CliComandoNamesMensagens } = getMessages();
12
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- CJS default interop
13
- // @ts-ignore
14
- const traverse = traverseModule.default ?? traverseModule;
15
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- CJS default interop
16
- // @ts-ignore
17
- const generate = generateModule.default ?? generateModule;
18
12
  function parseMappingLine(line) {
19
13
  const parts = line.split('=');
20
14
  if (parts.length < 2) {
@@ -174,6 +168,7 @@ function doApply(raizDir, srcDir, namesDir, mappingFile) {
174
168
  }
175
169
  }
176
170
  });
171
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
177
172
  if (changed) {
178
173
  const output = generate(ast, {
179
174
  retainLines: false,