@konvert7/klint 0.30.0 → 0.31.0
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 +21 -5
- package/core/arch-comments.ts +14 -0
- package/klint.schema.json +1275 -0
- package/klint.schema.yaml +999 -0
- package/package.json +8 -6
package/README.md
CHANGED
|
@@ -209,11 +209,23 @@ arch:
|
|
|
209
209
|
|
|
210
210
|
`klint.config.json` is still supported for backwards compatibility.
|
|
211
211
|
|
|
212
|
+
### Editor support
|
|
213
|
+
|
|
214
|
+
The package ships `klint.schema.json` and `klint.schema.yaml`, so the recommended
|
|
215
|
+
setup points at the installed copy:
|
|
216
|
+
|
|
217
|
+
```yaml
|
|
218
|
+
$schema: ./node_modules/@konvert7/klint/klint.schema.json
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
That file is installed alongside klint itself, so it cannot drift — upgrading klint
|
|
222
|
+
upgrades the schema with it. Both the inline `$schema` key above and the
|
|
223
|
+
`# yaml-language-server: $schema=…` modeline work; when both are present the modeline
|
|
224
|
+
wins. `klint.config.json` files are handled by the editor's built-in JSON support.
|
|
225
|
+
|
|
212
226
|
### Pinning the schema version
|
|
213
227
|
|
|
214
|
-
|
|
215
|
-
inside the package, which always matches the installed klint. To pin a specific
|
|
216
|
-
published schema instead, set `$schema` to a version-tagged URL:
|
|
228
|
+
To pin a specific published schema instead, set `$schema` to a version-tagged URL:
|
|
217
229
|
|
|
218
230
|
```yaml
|
|
219
231
|
$schema: https://raw.githubusercontent.com/konvert7/klint/refs/tags/v0.29.0/klint.schema.json
|
|
@@ -221,8 +233,12 @@ $schema: https://raw.githubusercontent.com/konvert7/klint/refs/tags/v0.29.0/klin
|
|
|
221
233
|
|
|
222
234
|
When the tagged version differs from the installed klint, the run reports a
|
|
223
235
|
`klint/schema-version` warning naming both versions and the URL to move to. It is a
|
|
224
|
-
warning, not an error — the exit code is unaffected. Local paths
|
|
225
|
-
|
|
236
|
+
warning, not an error — the exit code is unaffected. Local paths carry no version and
|
|
237
|
+
are never checked, which is why the installed copy above never warns.
|
|
238
|
+
|
|
239
|
+
This check runs when klint runs. Editors validate the config's *shape* against the
|
|
240
|
+
schema, but have no way to compare it against the installed klint, so the warning
|
|
241
|
+
appears in klint's output rather than as an editor diagnostic.
|
|
226
242
|
|
|
227
243
|
`klint --version` prints the installed version.
|
|
228
244
|
|
package/core/arch-comments.ts
CHANGED
|
@@ -15,6 +15,8 @@ function collectComments(file: string, content: string): CommentSpan[] {
|
|
|
15
15
|
const scanner = ts.createScanner(ts.ScriptTarget.Latest, false, variant, content);
|
|
16
16
|
const starts = lineStarts(content);
|
|
17
17
|
const spans: CommentSpan[] = [];
|
|
18
|
+
const substitutionDepths: number[] = [];
|
|
19
|
+
let braceDepth = 0;
|
|
18
20
|
let token = scanner.scan();
|
|
19
21
|
while (token !== ts.SyntaxKind.EndOfFileToken) {
|
|
20
22
|
if (
|
|
@@ -28,6 +30,18 @@ function collectComments(file: string, content: string): CommentSpan[] {
|
|
|
28
30
|
endLine: lineAt(starts, Math.max(start, end - 1)),
|
|
29
31
|
isDoc: isDocComment(content.slice(start, end)),
|
|
30
32
|
});
|
|
33
|
+
} else if (token === ts.SyntaxKind.TemplateHead) {
|
|
34
|
+
substitutionDepths.push(braceDepth);
|
|
35
|
+
} else if (token === ts.SyntaxKind.OpenBraceToken) {
|
|
36
|
+
braceDepth += 1;
|
|
37
|
+
} else if (token === ts.SyntaxKind.CloseBraceToken) {
|
|
38
|
+
if (substitutionDepths.at(-1) === braceDepth) {
|
|
39
|
+
if (scanner.reScanTemplateToken(false) === ts.SyntaxKind.TemplateTail) {
|
|
40
|
+
substitutionDepths.pop();
|
|
41
|
+
}
|
|
42
|
+
} else {
|
|
43
|
+
braceDepth -= 1;
|
|
44
|
+
}
|
|
31
45
|
}
|
|
32
46
|
token = scanner.scan();
|
|
33
47
|
}
|