@emeryld/manager 1.4.3 → 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.
@@ -10,7 +10,7 @@ export const DEFAULT_LIMITS = {
10
10
  maxFunctionsPerFile: 25,
11
11
  maxComponentsPerFile: 8,
12
12
  maxFileLength: 500,
13
- maxDuplicateLineOccurrences: 3,
13
+ maxDuplicateLineOccurrences: 1,
14
14
  minDuplicateLines: 3,
15
15
  exportOnly: true,
16
16
  indentationWidth: 2,
@@ -115,4 +115,5 @@ function logViolationEntry(entry, messagePrefix, locationDescriptor) {
115
115
  if (locationDescriptor) {
116
116
  console.log(` ${colors.dim(locationDescriptor)}`);
117
117
  }
118
+ console.log('');
118
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.3",
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",