@lewishowles/lint-config 0.5.0 → 0.6.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 +19 -0
- package/README.md +2 -2
- package/base.json +23 -4
- package/comments/plugin.js +2 -12
- package/comments/rules/configured-api-calls.js +2 -4
- package/comments/rules/formatting.js +868 -0
- package/comments/rules/variable-declarations.js +15 -5
- package/comments/rules/vue-component-documentation.js +5 -6
- package/comments/utils/documentation.js +31 -11
- package/comments/utils/jsdoc.js +78 -59
- package/comments/utils/source.js +0 -2
- package/comments/utils/wrap.js +123 -2
- package/comments.json +1 -6
- package/package.json +1 -1
- package/comments/rules/block-comments.js +0 -71
- package/comments/rules/jsdoc-tag-formatting.js +0 -71
- package/comments/rules/line-comments.js +0 -86
- package/comments/rules/max-line-length.js +0 -169
- package/comments/rules/placement.js +0 -293
- package/comments/rules/sentence-punctuation.js +0 -281
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.6.1: 2026-09-21
|
|
4
|
+
|
|
5
|
+
### Fixes
|
|
6
|
+
|
|
7
|
+
- `comments/function-documentation`: accept the name the JSDoc gives a destructured object parameter, instead of always expecting `options`.
|
|
8
|
+
|
|
9
|
+
## 0.6.0: 2026-09-21
|
|
10
|
+
|
|
11
|
+
### Changes
|
|
12
|
+
|
|
13
|
+
- Breaking: replace `comments/line-comments`, `comments/max-line-length`, `comments/sentence-punctuation`, `comments/block-comments`, `comments/jsdoc-tag-formatting`, and `comments/placement` with a single `comments/formatting` rule. Remove the old rule IDs from your configuration; `comments.json` already enables `comments/formatting`.
|
|
14
|
+
- Breaking: `base` now reports an error when statements of different kinds, such as a declaration followed by a function call, have no blank line between them, and when consecutive `const` or `let` declarations are separated by a blank line. Run `--fix` once to update existing code.
|
|
15
|
+
- `comments/formatting` moves trailing line comments onto their own line above the code.
|
|
16
|
+
|
|
17
|
+
### Fixes
|
|
18
|
+
|
|
19
|
+
- `comments/formatting`: refill comment lines that were wrapped before the 80-column limit.
|
|
20
|
+
- `comments/variable-declarations`: skip the line-comment requirement for `const` declarations assigned to arrow functions or function expressions.
|
|
21
|
+
|
|
3
22
|
## 0.5.0: 2026-09-11
|
|
4
23
|
|
|
5
24
|
### Changes
|
package/README.md
CHANGED
|
@@ -49,7 +49,7 @@ The Vue layer extends `base.json` internally, so you only need to extend `vue.js
|
|
|
49
49
|
|
|
50
50
|
### Comment formatting (optional)
|
|
51
51
|
|
|
52
|
-
Add the comments layer alongside the base or Vue layer to enforce the comment-formatting rules, variable-declaration documentation, JSDoc on named functions and first-level object methods, documentation directly after each Vue `<script setup>` opening tag, and block comments for runtime `defineProps` properties:
|
|
52
|
+
Add the comments layer alongside the base or Vue layer to enforce the comment-formatting rules, including moving trailing line comments onto their own line, variable-declaration documentation, JSDoc on named functions and first-level object methods, documentation directly after each Vue `<script setup>` opening tag, and block comments for runtime `defineProps` properties:
|
|
53
53
|
|
|
54
54
|
```json
|
|
55
55
|
{
|
|
@@ -73,7 +73,7 @@ The Vue component rule reads the raw `.vue` file because Oxlint's JS Plugin API
|
|
|
73
73
|
}
|
|
74
74
|
],
|
|
75
75
|
"rules": {
|
|
76
|
-
"comments/
|
|
76
|
+
"comments/formatting": "error"
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
```
|
package/base.json
CHANGED
|
@@ -35,13 +35,32 @@
|
|
|
35
35
|
"@stylistic/no-confusing-arrow": "error",
|
|
36
36
|
"@stylistic/padding-line-between-statements": [
|
|
37
37
|
"error",
|
|
38
|
-
{ "blankLine": "always", "prev": "const", "next": "let" },
|
|
39
|
-
{ "blankLine": "always", "prev": "let", "next": "const" },
|
|
40
38
|
{ "blankLine": "always", "prev": "*", "next": "break" },
|
|
41
39
|
{ "blankLine": "always", "prev": ["const", "let"], "next": "*" },
|
|
40
|
+
{ "blankLine": "always", "prev": "*", "next": ["const", "let"] },
|
|
42
41
|
{ "blankLine": "always", "prev": "*", "next": "return" },
|
|
43
|
-
{
|
|
44
|
-
|
|
42
|
+
{
|
|
43
|
+
"blankLine": "always",
|
|
44
|
+
"prev": ["block-like", "class", "do", "for", "function", "if", "switch", "try", "while"],
|
|
45
|
+
"next": "*"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"blankLine": "always",
|
|
49
|
+
"prev": "*",
|
|
50
|
+
"next": ["block-like", "class", "do", "for", "function", "if", "switch", "try", "while"]
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"blankLine": "always",
|
|
54
|
+
"prev": { "selector": "ExpressionStatement[expression.type=\"AssignmentExpression\"]" },
|
|
55
|
+
"next": { "selector": "ExpressionStatement[expression.type=\"CallExpression\"]" }
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"blankLine": "always",
|
|
59
|
+
"prev": { "selector": "ExpressionStatement[expression.type=\"CallExpression\"]" },
|
|
60
|
+
"next": { "selector": "ExpressionStatement[expression.type=\"AssignmentExpression\"]" }
|
|
61
|
+
},
|
|
62
|
+
{ "blankLine": "never", "prev": "const", "next": "const" },
|
|
63
|
+
{ "blankLine": "never", "prev": "let", "next": "let" },
|
|
45
64
|
{ "blankLine": "always", "prev": "multiline-const", "next": "*" },
|
|
46
65
|
{ "blankLine": "always", "prev": "*", "next": "multiline-const" }
|
|
47
66
|
],
|
package/comments/plugin.js
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import blockComments from "./rules/block-comments.js";
|
|
2
1
|
import classDocumentation from "./rules/class-documentation.js";
|
|
3
2
|
import configuredApiCalls from "./rules/configured-api-calls.js";
|
|
3
|
+
import formatting from "./rules/formatting.js";
|
|
4
4
|
import functionDocumentation from "./rules/function-documentation.js";
|
|
5
|
-
import jsdocTagFormatting from "./rules/jsdoc-tag-formatting.js";
|
|
6
|
-
import lineComments from "./rules/line-comments.js";
|
|
7
|
-
import maxLineLength from "./rules/max-line-length.js";
|
|
8
|
-
import placement from "./rules/placement.js";
|
|
9
|
-
import sentencePunctuation from "./rules/sentence-punctuation.js";
|
|
10
5
|
import variableDeclarations from "./rules/variable-declarations.js";
|
|
11
6
|
import vueComponentDocumentation from "./rules/vue-component-documentation.js";
|
|
12
7
|
import vueEmitDocumentation from "./rules/vue-emit-documentation.js";
|
|
@@ -15,15 +10,10 @@ import vuePropDocumentation from "./rules/vue-prop-documentation.js";
|
|
|
15
10
|
export default {
|
|
16
11
|
meta: { name: "comments" },
|
|
17
12
|
rules: {
|
|
18
|
-
"block-comments": blockComments,
|
|
19
13
|
"class-documentation": classDocumentation,
|
|
20
14
|
"configured-api-calls": configuredApiCalls,
|
|
15
|
+
formatting,
|
|
21
16
|
"function-documentation": functionDocumentation,
|
|
22
|
-
"jsdoc-tag-formatting": jsdocTagFormatting,
|
|
23
|
-
"line-comments": lineComments,
|
|
24
|
-
"max-line-length": maxLineLength,
|
|
25
|
-
placement,
|
|
26
|
-
"sentence-punctuation": sentencePunctuation,
|
|
27
17
|
"variable-declarations": variableDeclarations,
|
|
28
18
|
"vue-component-documentation": vueComponentDocumentation,
|
|
29
19
|
"vue-emit-documentation": vueEmitDocumentation,
|
|
@@ -118,10 +118,8 @@ export default {
|
|
|
118
118
|
*/
|
|
119
119
|
CallExpression(node) {
|
|
120
120
|
// Read fresh for every call: createOnce's visitor is shared
|
|
121
|
-
// across every file
|
|
122
|
-
//
|
|
123
|
-
// freeze the first
|
|
124
|
-
// file's options.
|
|
121
|
+
// across every file in the run, so caching this at
|
|
122
|
+
// closure-creation time would freeze the first file's options.
|
|
125
123
|
const configuredApis = getConfiguredApis(context);
|
|
126
124
|
|
|
127
125
|
if (node.callee.type !== "Identifier" || !configuredApis.has(node.callee.name)) {
|