@emeryld/manager 1.4.4 → 1.4.5

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.
@@ -23,18 +23,12 @@ export function reportViolations(violations, reportingMode) {
23
23
  return false;
24
24
  }
25
25
  console.log(colors.bold('Format checker violations:'));
26
- console.log('');
27
26
  if (reportingMode === 'group') {
28
- let hasPrintedGroupBlock = false;
29
27
  for (const type of TYPE_ORDER) {
30
28
  const entries = violations.filter((violation) => violation.type === type);
31
29
  if (!entries.length)
32
30
  continue;
33
31
  entries.sort((a, b) => b.severity - a.severity);
34
- if (hasPrintedGroupBlock) {
35
- console.log('');
36
- }
37
- hasPrintedGroupBlock = true;
38
32
  console.log(colors.bold(`- ${TYPE_LABELS[type]} (${entries.length})`));
39
33
  for (const entry of entries) {
40
34
  const relativePath = path.relative(rootDir, entry.file) || entry.file;
@@ -59,10 +53,10 @@ export function reportViolations(violations, reportingMode) {
59
53
  });
60
54
  }
61
55
  }
56
+ console.log('');
62
57
  }
63
58
  }
64
59
  else {
65
- let hasPrintedFileBlock = false;
66
60
  const violationsByFile = new Map();
67
61
  for (const entry of violations) {
68
62
  const bucket = violationsByFile.get(entry.file);
@@ -76,10 +70,6 @@ export function reportViolations(violations, reportingMode) {
76
70
  const sortedFiles = [...violationsByFile.entries()].sort(([a], [b]) => a.localeCompare(b));
77
71
  for (const [file, entries] of sortedFiles) {
78
72
  const relativePath = path.relative(rootDir, file) || file;
79
- if (hasPrintedFileBlock) {
80
- console.log('');
81
- }
82
- hasPrintedFileBlock = true;
83
73
  console.log(colors.bold(relativePath));
84
74
  const sortedEntries = [...entries].sort((a, b) => (a.line ?? 0) - (b.line ?? 0));
85
75
  for (const entry of sortedEntries) {
@@ -107,6 +97,7 @@ export function reportViolations(violations, reportingMode) {
107
97
  }
108
98
  logViolationEntry(entry, ' ', locationDescriptor);
109
99
  }
100
+ console.log('');
110
101
  }
111
102
  }
112
103
  return true;
@@ -124,4 +115,5 @@ function logViolationEntry(entry, messagePrefix, locationDescriptor) {
124
115
  if (locationDescriptor) {
125
116
  console.log(` ${colors.dim(locationDescriptor)}`);
126
117
  }
118
+ console.log('');
127
119
  }
@@ -103,13 +103,13 @@ function ensureFileSnapshot(fileSnapshots, filePath, normalizedLines, lines, sou
103
103
  });
104
104
  }
105
105
  function fingerprintLine(entry) {
106
+ if (entry.isImport)
107
+ return undefined;
106
108
  if (entry.normalized)
107
109
  return entry.normalized;
108
110
  const collapsed = entry.trimmed.replace(/\s+/g, ' ');
109
111
  if (!collapsed)
110
112
  return undefined;
111
- if (!/[A-Za-z0-9]/.test(collapsed))
112
- return undefined;
113
113
  return collapsed.toLowerCase();
114
114
  }
115
115
  function buildOccurrenceInfo(occurrence, fileSnapshots) {
@@ -136,7 +136,17 @@ function expandDuplicateTracker(tracker, fileSnapshots) {
136
136
  if (infos.length < 2)
137
137
  return undefined;
138
138
  expandRangeAcrossOccurrences(infos);
139
- const primary = infos[0];
139
+ const primary = infos.reduce((current, info) => {
140
+ if (!current)
141
+ return info;
142
+ const pathComparison = current.file.localeCompare(info.file);
143
+ if (pathComparison > 0)
144
+ return info;
145
+ if (pathComparison === 0 && info.startIndex < current.startIndex) {
146
+ return info;
147
+ }
148
+ return current;
149
+ }, infos[0]);
140
150
  const lines = primary.snapshot.normalizedLines
141
151
  .slice(primary.startIndex, primary.endIndex + 1)
142
152
  .map((entry) => entry.trimmed)
@@ -154,9 +164,16 @@ function expandDuplicateTracker(tracker, fileSnapshots) {
154
164
  endLine,
155
165
  endColumn,
156
166
  });
167
+ const detailInfos = [...infos].sort((a, b) => {
168
+ const pathComparison = a.file.localeCompare(b.file);
169
+ if (pathComparison !== 0)
170
+ return pathComparison;
171
+ return a.startIndex - b.startIndex;
172
+ });
173
+ const detail = detailInfos.map(formatOccurrenceDetail).join('\n');
157
174
  return {
158
175
  snippet,
159
- detail: infos.map(formatOccurrenceDetail).join('\n'),
176
+ detail,
160
177
  requiredVariables,
161
178
  };
162
179
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emeryld/manager",
3
- "version": "1.4.4",
3
+ "version": "1.4.5",
4
4
  "description": "Interactive manager for pnpm monorepos (update/test/build/publish).",
5
5
  "license": "MIT",
6
6
  "type": "module",