@d3lm/lint-preset 1.5.1 → 1.5.2

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/dist/comments.cjs CHANGED
@@ -537,6 +537,19 @@ function layoutLines(tokens, firstLimit, restLimit, options) {
537
537
  return lines;
538
538
  }
539
539
  }
540
+ if (options.tolerance > 0 && greedy.length > 2) {
541
+ const fewer = balanceTokens(
542
+ tokens,
543
+ firstLimit + options.tolerance,
544
+ restLimit + options.tolerance,
545
+ greedy.length - 1,
546
+ options,
547
+ restLimit
548
+ );
549
+ if (fewer && !hasStep(fewer, restLimit - firstLimit)) {
550
+ return fewer;
551
+ }
552
+ }
540
553
  const balanced = balanceTokens(tokens, firstLimit, restLimit, greedy.length, options);
541
554
  if (balanced) {
542
555
  return balanced;
@@ -1284,7 +1297,7 @@ When rules pull in different directions, the earlier one wins.
1284
1297
 
1285
1298
  ## Layout
1286
1299
 
1287
- - After you finish, the tool rewraps prose paragraphs, list items, and JSDoc tag descriptions. The width is a preferred target. A parenthetical may extend a line up to the configured maximum so it stays together. In longer paragraphs, balanced lines take priority over keeping every parenthetical on one line. The tool also avoids short last lines where possible. Leave these line breaks to the tool, except for the sentence-orphan case below.
1300
+ - After you finish, the tool rewraps prose paragraphs, list items, and JSDoc tag descriptions. The width is a preferred target. A parenthetical may extend a line up to the configured maximum so it stays together, and lines may go up to the configured tolerance past the width when that saves a line. In longer paragraphs, balanced lines take priority over keeping every parenthetical on one line. The tool also avoids short last lines where possible. Leave these line breaks to the tool, except for the sentence-orphan case below.
1288
1301
  - Don't end a line with the first word of a new sentence, clause, or parenthetical, like \`This\` after a period, \`the\` after a comma, or \`(the\`. Move it to the next line instead.
1289
1302
  - In a paragraph of two lines, the first line ends with a sentence whenever the rest fits on the second line and is no longer than the first. Don't end it with the start of the next sentence, like \`A wrap\` in \`...lay out differently. A wrap\`. Move those words to the second line instead.
1290
1303
  - A comment whose whole text is one paragraph stays on a single line when that line fits a separate, larger single-line width, even past the width. Only a longer comment wraps to the width.