@d3lm/lint-preset 1.6.2 → 1.6.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.
- package/README.md +4 -3
- package/dist/bin/comments.js +18 -5
- package/dist/bin/comments.js.map +1 -1
- package/dist/comments.cjs +17 -5
- package/dist/comments.cjs.map +1 -1
- package/dist/comments.d.cts +7 -6
- package/dist/comments.d.ts +7 -6
- package/dist/comments.js +17 -5
- package/dist/comments.js.map +1 -1
- package/package.json +1 -1
package/dist/comments.cjs
CHANGED
|
@@ -775,6 +775,7 @@ var ISSUE_TIERS = {
|
|
|
775
775
|
underfill: "verdict",
|
|
776
776
|
widow: "verdict",
|
|
777
777
|
unbalanced: "verdict",
|
|
778
|
+
wide: "verdict",
|
|
778
779
|
orphan: "hint",
|
|
779
780
|
"split-parenthetical": "hint",
|
|
780
781
|
banner: "hint",
|
|
@@ -1361,6 +1362,14 @@ function analyzeParagraph(paragraph, options, language) {
|
|
|
1361
1362
|
const restLines = layoutTokens(rest, restLimit, restLimit, restOptions);
|
|
1362
1363
|
return sameLayout(breakAfterSentence(restLines, restLimit, restLimit, restOptions), currentLines.slice(line + 1));
|
|
1363
1364
|
};
|
|
1365
|
+
const differenceAt = (line) => {
|
|
1366
|
+
const longest = Math.max(...wrapped.map((words) => words.join(" ").length));
|
|
1367
|
+
const wide = currentLines.flatMap((words, position) => {
|
|
1368
|
+
const limit = (position === 0 ? firstLimit : restLimit) + layoutOptions.tolerance;
|
|
1369
|
+
return words.join(" ").length > Math.max(limit, longest) ? [{ type: "wide", line: position }] : [];
|
|
1370
|
+
});
|
|
1371
|
+
return wide.length > 0 ? wide : [{ type: "unbalanced", line }];
|
|
1372
|
+
};
|
|
1364
1373
|
if (overflow.length === 0 && (currentLines.length === wrapped.length || options.maxWidth !== void 0)) {
|
|
1365
1374
|
const line = Math.max(
|
|
1366
1375
|
wrapped.findIndex((words, position) => words.join(" ") !== _optionalChain([currentLines, 'access', _38 => _38[position], 'optionalAccess', _39 => _39.join, 'call', _40 => _40(" ")])),
|
|
@@ -1369,9 +1378,11 @@ function analyzeParagraph(paragraph, options, language) {
|
|
|
1369
1378
|
if (lineIssues.length === 0 && (sameLayout(even, currentLines) || keepsOnlySentenceStarts())) {
|
|
1370
1379
|
lineIssues.push({ type: "orphan", line });
|
|
1371
1380
|
} else if (lineIssues.length === 0) {
|
|
1372
|
-
lineIssues.push(
|
|
1381
|
+
lineIssues.push(
|
|
1382
|
+
...splitsOnlyParenthetical(line) ? [{ type: "split-parenthetical", line }] : differenceAt(line)
|
|
1383
|
+
);
|
|
1373
1384
|
} else if (lineIssues.every((issue) => issue.type === "orphan") && !sameLayout(even, currentLines) && !keepsOnlyOrphans()) {
|
|
1374
|
-
lineIssues.push(
|
|
1385
|
+
lineIssues.push(...differenceAt(line));
|
|
1375
1386
|
}
|
|
1376
1387
|
}
|
|
1377
1388
|
const splitLine = splitTokenLine(currentLines, tokens);
|
|
@@ -1389,14 +1400,15 @@ function analyzeParagraph(paragraph, options, language) {
|
|
|
1389
1400
|
return false;
|
|
1390
1401
|
};
|
|
1391
1402
|
const staysNearLayout = () => {
|
|
1392
|
-
if (currentLines.length !== wrapped.length || splitTokenLine(currentLines, units) !== -1) {
|
|
1403
|
+
if (layoutOptions.tolerance === 0 || currentLines.length !== wrapped.length || splitTokenLine(currentLines, units) !== -1) {
|
|
1393
1404
|
return false;
|
|
1394
1405
|
}
|
|
1406
|
+
const shortest = Math.min(...wrapped.slice(0, -1).map((words) => words.join(" ").length));
|
|
1395
1407
|
return currentLines.every((words, position) => {
|
|
1396
1408
|
const length = words.join(" ").length;
|
|
1397
|
-
const suggestedLength = wrapped[position].join(" ").length;
|
|
1398
1409
|
const limit = (position === 0 ? firstLimit : restLimit) + layoutOptions.tolerance;
|
|
1399
|
-
|
|
1410
|
+
const isLast = position === currentLines.length - 1;
|
|
1411
|
+
return (isLast || length >= shortest - layoutOptions.tolerance) && length <= Math.max(wrapped[position].join(" ").length, limit);
|
|
1400
1412
|
});
|
|
1401
1413
|
};
|
|
1402
1414
|
const hasVerdict = lineIssues.some((issue) => isVerdict(issue));
|