@lewishowles/lint-config 0.9.0 → 0.9.1
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/CHANGELOG.md +6 -0
- package/comments/rules/formatting.js +9 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.9.1: 2026-10-10
|
|
4
|
+
|
|
5
|
+
### Fixes
|
|
6
|
+
|
|
7
|
+
- `comments/formatting` accepts a comment as the only thing between a pair of braces, such as in an empty catch block, function body or object literal. It still checks the comment's sentence formatting.
|
|
8
|
+
|
|
3
9
|
## 0.9.0: 2026-10-07
|
|
4
10
|
|
|
5
11
|
### Changes
|
|
@@ -347,6 +347,10 @@ function getBlockCommentDisplayLines(commentText, indentation) {
|
|
|
347
347
|
* the fix never edits the directive. When an ordinary comment sits between them
|
|
348
348
|
* instead, only the indentation is fixed and the gap is left alone.
|
|
349
349
|
*
|
|
350
|
+
* A comment that is the only thing between a pair of braces, such as in an
|
|
351
|
+
* empty catch block or object literal, has no code to sit above, so it is left
|
|
352
|
+
* where it is.
|
|
353
|
+
*
|
|
350
354
|
* @param {object} sourceCode
|
|
351
355
|
* The Oxlint source code object.
|
|
352
356
|
* @param {object} comment
|
|
@@ -364,7 +368,11 @@ function getLeadingCommentPlacement(sourceCode, comment, lastComment, comments)
|
|
|
364
368
|
// The code token the comment documents, and the token before the comment.
|
|
365
369
|
const { next, previous } = getCommentNeighbours(sourceCode, comment);
|
|
366
370
|
|
|
367
|
-
if (
|
|
371
|
+
if (
|
|
372
|
+
next === null ||
|
|
373
|
+
!isLeadingComment(sourceCode, comment, previous) ||
|
|
374
|
+
(previous?.value === "{" && next.value === "}")
|
|
375
|
+
) {
|
|
368
376
|
return null;
|
|
369
377
|
}
|
|
370
378
|
|