@konvert7/klint 0.30.0 → 0.32.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 +92 -29
- package/core/arch-comments.ts +14 -0
- package/core/config.schema.ts +2 -2
- package/klint.schema.json +1275 -0
- package/klint.schema.yaml +1001 -0
- package/package.json +8 -6
|
@@ -0,0 +1,1275 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "https://raw.githubusercontent.com/konvert7/klint/refs/tags/v0.32.0/klint.schema.json",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"$schema": {
|
|
7
|
+
"description": "JSON Schema reference. Use ./klint.schema.json for local validation, or a version-tagged URL such as https://raw.githubusercontent.com/konvert7/klint/refs/tags/v0.29.0/klint.schema.json to pin the schema. A tagged URL naming a version other than the installed one raises a klint/schema-version warning.",
|
|
8
|
+
"type": "string"
|
|
9
|
+
},
|
|
10
|
+
"root": {
|
|
11
|
+
"description": "Root directory used to resolve include paths and report relative file names. Defaults to the directory containing klint.config.json.",
|
|
12
|
+
"type": "string"
|
|
13
|
+
},
|
|
14
|
+
"include": {
|
|
15
|
+
"description": "Glob patterns selecting which TypeScript files to lint. Prefix with ! to exclude. Defaults to [\".\"] which lints all .ts files under root. Example: [\"src\", \"klint\", \"!**/node_modules/**\"]",
|
|
16
|
+
"type": "array",
|
|
17
|
+
"items": {
|
|
18
|
+
"type": "string"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"plugins": {
|
|
22
|
+
"description": "Named rule bundles to enable. Each plugin applies a default set of rules at \"error\" severity. Individual rules from the bundle can be overridden or silenced via the rules map. Available: \"sonar\".",
|
|
23
|
+
"type": "array",
|
|
24
|
+
"items": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"enum": [
|
|
27
|
+
"sonar"
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"rules": {
|
|
32
|
+
"description": "Map of rule name → severity or options. Example: { \"no-floating-promise\": \"error\", \"no-sync-in-async\": { \"severity\": \"warn\", \"include\": [\"src/hooks/**\"] } }.",
|
|
33
|
+
"type": "object",
|
|
34
|
+
"properties": {
|
|
35
|
+
"no-unguarded-json-parse": {
|
|
36
|
+
"description": "Flags `JSON.parse()` calls that aren't wrapped in try/catch — malformed input crashes the process.",
|
|
37
|
+
"examples": [
|
|
38
|
+
"no-unguarded-json-parse: error"
|
|
39
|
+
],
|
|
40
|
+
"anyOf": [
|
|
41
|
+
{
|
|
42
|
+
"type": "string",
|
|
43
|
+
"enum": [
|
|
44
|
+
"error",
|
|
45
|
+
"warn",
|
|
46
|
+
"off"
|
|
47
|
+
],
|
|
48
|
+
"description": "Rule severity. \"error\" exits with code 2; \"warn\" reports but exits 0; \"off\" silences."
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"type": "object",
|
|
52
|
+
"properties": {
|
|
53
|
+
"severity": {
|
|
54
|
+
"type": "string",
|
|
55
|
+
"enum": [
|
|
56
|
+
"error",
|
|
57
|
+
"warn",
|
|
58
|
+
"off"
|
|
59
|
+
],
|
|
60
|
+
"description": "Rule severity. \"error\" exits with code 2; \"warn\" reports but exits 0; \"off\" silences."
|
|
61
|
+
},
|
|
62
|
+
"include": {
|
|
63
|
+
"description": "Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: [\"src/hooks/**\", \"!src/hooks/scripts/**\"]",
|
|
64
|
+
"type": "array",
|
|
65
|
+
"items": {
|
|
66
|
+
"type": "string"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"additionalProperties": false,
|
|
71
|
+
"description": "Rule options object. Omit severity to default to \"error\". Add include to scope the rule to specific files."
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
"no-sync-in-async": {
|
|
76
|
+
"description": "Flags synchronous I/O (`readFileSync`, `execSync`, etc.) inside async functions — blocks the event loop when an async equivalent is available.",
|
|
77
|
+
"examples": [
|
|
78
|
+
"no-sync-in-async: error",
|
|
79
|
+
"no-sync-in-async:\n severity: warn\n include: [\"src/server/**\"]"
|
|
80
|
+
],
|
|
81
|
+
"anyOf": [
|
|
82
|
+
{
|
|
83
|
+
"type": "string",
|
|
84
|
+
"enum": [
|
|
85
|
+
"error",
|
|
86
|
+
"warn",
|
|
87
|
+
"off"
|
|
88
|
+
],
|
|
89
|
+
"description": "Rule severity. \"error\" exits with code 2; \"warn\" reports but exits 0; \"off\" silences."
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"type": "object",
|
|
93
|
+
"properties": {
|
|
94
|
+
"severity": {
|
|
95
|
+
"type": "string",
|
|
96
|
+
"enum": [
|
|
97
|
+
"error",
|
|
98
|
+
"warn",
|
|
99
|
+
"off"
|
|
100
|
+
],
|
|
101
|
+
"description": "Rule severity. \"error\" exits with code 2; \"warn\" reports but exits 0; \"off\" silences."
|
|
102
|
+
},
|
|
103
|
+
"include": {
|
|
104
|
+
"description": "Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: [\"src/hooks/**\", \"!src/hooks/scripts/**\"]",
|
|
105
|
+
"type": "array",
|
|
106
|
+
"items": {
|
|
107
|
+
"type": "string"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"additionalProperties": false,
|
|
112
|
+
"description": "Rule options object. Omit severity to default to \"error\". Add include to scope the rule to specific files."
|
|
113
|
+
}
|
|
114
|
+
]
|
|
115
|
+
},
|
|
116
|
+
"no-floating-promise": {
|
|
117
|
+
"description": "Flags Promise-returning expressions that aren't awaited or `.catch()`-handled — silent failures and unpredictable execution order.",
|
|
118
|
+
"examples": [
|
|
119
|
+
"no-floating-promise: error"
|
|
120
|
+
],
|
|
121
|
+
"anyOf": [
|
|
122
|
+
{
|
|
123
|
+
"type": "string",
|
|
124
|
+
"enum": [
|
|
125
|
+
"error",
|
|
126
|
+
"warn",
|
|
127
|
+
"off"
|
|
128
|
+
],
|
|
129
|
+
"description": "Rule severity. \"error\" exits with code 2; \"warn\" reports but exits 0; \"off\" silences."
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"type": "object",
|
|
133
|
+
"properties": {
|
|
134
|
+
"severity": {
|
|
135
|
+
"type": "string",
|
|
136
|
+
"enum": [
|
|
137
|
+
"error",
|
|
138
|
+
"warn",
|
|
139
|
+
"off"
|
|
140
|
+
],
|
|
141
|
+
"description": "Rule severity. \"error\" exits with code 2; \"warn\" reports but exits 0; \"off\" silences."
|
|
142
|
+
},
|
|
143
|
+
"include": {
|
|
144
|
+
"description": "Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: [\"src/hooks/**\", \"!src/hooks/scripts/**\"]",
|
|
145
|
+
"type": "array",
|
|
146
|
+
"items": {
|
|
147
|
+
"type": "string"
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
"additionalProperties": false,
|
|
152
|
+
"description": "Rule options object. Omit severity to default to \"error\". Add include to scope the rule to specific files."
|
|
153
|
+
}
|
|
154
|
+
]
|
|
155
|
+
},
|
|
156
|
+
"no-misused-promises": {
|
|
157
|
+
"description": "Flags Promises passed where the type expects a non-thenable (e.g. an `if` condition, a `void` callback). The Promise's truthiness — not its resolved value — drives the branch.",
|
|
158
|
+
"examples": [
|
|
159
|
+
"no-misused-promises: error"
|
|
160
|
+
],
|
|
161
|
+
"anyOf": [
|
|
162
|
+
{
|
|
163
|
+
"type": "string",
|
|
164
|
+
"enum": [
|
|
165
|
+
"error",
|
|
166
|
+
"warn",
|
|
167
|
+
"off"
|
|
168
|
+
],
|
|
169
|
+
"description": "Rule severity. \"error\" exits with code 2; \"warn\" reports but exits 0; \"off\" silences."
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"type": "object",
|
|
173
|
+
"properties": {
|
|
174
|
+
"severity": {
|
|
175
|
+
"type": "string",
|
|
176
|
+
"enum": [
|
|
177
|
+
"error",
|
|
178
|
+
"warn",
|
|
179
|
+
"off"
|
|
180
|
+
],
|
|
181
|
+
"description": "Rule severity. \"error\" exits with code 2; \"warn\" reports but exits 0; \"off\" silences."
|
|
182
|
+
},
|
|
183
|
+
"include": {
|
|
184
|
+
"description": "Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: [\"src/hooks/**\", \"!src/hooks/scripts/**\"]",
|
|
185
|
+
"type": "array",
|
|
186
|
+
"items": {
|
|
187
|
+
"type": "string"
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
"additionalProperties": false,
|
|
192
|
+
"description": "Rule options object. Omit severity to default to \"error\". Add include to scope the rule to specific files."
|
|
193
|
+
}
|
|
194
|
+
]
|
|
195
|
+
},
|
|
196
|
+
"no-async-predicate": {
|
|
197
|
+
"description": "Flags `async` functions passed to `.filter`/`.some`/`.every`/`.find`/`.findIndex`. Array methods coerce the returned promise to truthy, so every element appears to match.",
|
|
198
|
+
"examples": [
|
|
199
|
+
"no-async-predicate: error"
|
|
200
|
+
],
|
|
201
|
+
"anyOf": [
|
|
202
|
+
{
|
|
203
|
+
"type": "string",
|
|
204
|
+
"enum": [
|
|
205
|
+
"error",
|
|
206
|
+
"warn",
|
|
207
|
+
"off"
|
|
208
|
+
],
|
|
209
|
+
"description": "Rule severity. \"error\" exits with code 2; \"warn\" reports but exits 0; \"off\" silences."
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"type": "object",
|
|
213
|
+
"properties": {
|
|
214
|
+
"severity": {
|
|
215
|
+
"type": "string",
|
|
216
|
+
"enum": [
|
|
217
|
+
"error",
|
|
218
|
+
"warn",
|
|
219
|
+
"off"
|
|
220
|
+
],
|
|
221
|
+
"description": "Rule severity. \"error\" exits with code 2; \"warn\" reports but exits 0; \"off\" silences."
|
|
222
|
+
},
|
|
223
|
+
"include": {
|
|
224
|
+
"description": "Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: [\"src/hooks/**\", \"!src/hooks/scripts/**\"]",
|
|
225
|
+
"type": "array",
|
|
226
|
+
"items": {
|
|
227
|
+
"type": "string"
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
"additionalProperties": false,
|
|
232
|
+
"description": "Rule options object. Omit severity to default to \"error\". Add include to scope the rule to specific files."
|
|
233
|
+
}
|
|
234
|
+
]
|
|
235
|
+
},
|
|
236
|
+
"no-date-equality": {
|
|
237
|
+
"description": "Flags `Date` comparisons with `==`/`===`/`!=`/`!==` — these compare object identity, not the time value. Use `.getTime()` instead.",
|
|
238
|
+
"examples": [
|
|
239
|
+
"no-date-equality: error"
|
|
240
|
+
],
|
|
241
|
+
"anyOf": [
|
|
242
|
+
{
|
|
243
|
+
"type": "string",
|
|
244
|
+
"enum": [
|
|
245
|
+
"error",
|
|
246
|
+
"warn",
|
|
247
|
+
"off"
|
|
248
|
+
],
|
|
249
|
+
"description": "Rule severity. \"error\" exits with code 2; \"warn\" reports but exits 0; \"off\" silences."
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
"type": "object",
|
|
253
|
+
"properties": {
|
|
254
|
+
"severity": {
|
|
255
|
+
"type": "string",
|
|
256
|
+
"enum": [
|
|
257
|
+
"error",
|
|
258
|
+
"warn",
|
|
259
|
+
"off"
|
|
260
|
+
],
|
|
261
|
+
"description": "Rule severity. \"error\" exits with code 2; \"warn\" reports but exits 0; \"off\" silences."
|
|
262
|
+
},
|
|
263
|
+
"include": {
|
|
264
|
+
"description": "Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: [\"src/hooks/**\", \"!src/hooks/scripts/**\"]",
|
|
265
|
+
"type": "array",
|
|
266
|
+
"items": {
|
|
267
|
+
"type": "string"
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
"additionalProperties": false,
|
|
272
|
+
"description": "Rule options object. Omit severity to default to \"error\". Add include to scope the rule to specific files."
|
|
273
|
+
}
|
|
274
|
+
]
|
|
275
|
+
},
|
|
276
|
+
"no-optional-chain-on-non-nullable": {
|
|
277
|
+
"description": "Flags `?.` on receivers whose static type cannot be `null` or `undefined`. The optional chain is dead code and obscures the real shape.",
|
|
278
|
+
"examples": [
|
|
279
|
+
"no-optional-chain-on-non-nullable: warn"
|
|
280
|
+
],
|
|
281
|
+
"anyOf": [
|
|
282
|
+
{
|
|
283
|
+
"type": "string",
|
|
284
|
+
"enum": [
|
|
285
|
+
"error",
|
|
286
|
+
"warn",
|
|
287
|
+
"off"
|
|
288
|
+
],
|
|
289
|
+
"description": "Rule severity. \"error\" exits with code 2; \"warn\" reports but exits 0; \"off\" silences."
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
"type": "object",
|
|
293
|
+
"properties": {
|
|
294
|
+
"severity": {
|
|
295
|
+
"type": "string",
|
|
296
|
+
"enum": [
|
|
297
|
+
"error",
|
|
298
|
+
"warn",
|
|
299
|
+
"off"
|
|
300
|
+
],
|
|
301
|
+
"description": "Rule severity. \"error\" exits with code 2; \"warn\" reports but exits 0; \"off\" silences."
|
|
302
|
+
},
|
|
303
|
+
"include": {
|
|
304
|
+
"description": "Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: [\"src/hooks/**\", \"!src/hooks/scripts/**\"]",
|
|
305
|
+
"type": "array",
|
|
306
|
+
"items": {
|
|
307
|
+
"type": "string"
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
"additionalProperties": false,
|
|
312
|
+
"description": "Rule options object. Omit severity to default to \"error\". Add include to scope the rule to specific files."
|
|
313
|
+
}
|
|
314
|
+
]
|
|
315
|
+
},
|
|
316
|
+
"no-object-in-template": {
|
|
317
|
+
"description": "Flags non-primitive objects interpolated into template literals — produces `[object Object]` unless `toString()` is overridden.",
|
|
318
|
+
"examples": [
|
|
319
|
+
"no-object-in-template: error"
|
|
320
|
+
],
|
|
321
|
+
"anyOf": [
|
|
322
|
+
{
|
|
323
|
+
"type": "string",
|
|
324
|
+
"enum": [
|
|
325
|
+
"error",
|
|
326
|
+
"warn",
|
|
327
|
+
"off"
|
|
328
|
+
],
|
|
329
|
+
"description": "Rule severity. \"error\" exits with code 2; \"warn\" reports but exits 0; \"off\" silences."
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
"type": "object",
|
|
333
|
+
"properties": {
|
|
334
|
+
"severity": {
|
|
335
|
+
"type": "string",
|
|
336
|
+
"enum": [
|
|
337
|
+
"error",
|
|
338
|
+
"warn",
|
|
339
|
+
"off"
|
|
340
|
+
],
|
|
341
|
+
"description": "Rule severity. \"error\" exits with code 2; \"warn\" reports but exits 0; \"off\" silences."
|
|
342
|
+
},
|
|
343
|
+
"include": {
|
|
344
|
+
"description": "Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: [\"src/hooks/**\", \"!src/hooks/scripts/**\"]",
|
|
345
|
+
"type": "array",
|
|
346
|
+
"items": {
|
|
347
|
+
"type": "string"
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
},
|
|
351
|
+
"additionalProperties": false,
|
|
352
|
+
"description": "Rule options object. Omit severity to default to \"error\". Add include to scope the rule to specific files."
|
|
353
|
+
}
|
|
354
|
+
]
|
|
355
|
+
},
|
|
356
|
+
"no-nested-template-literals": {
|
|
357
|
+
"description": "Flags template literals nested inside template literals — almost always unreadable; extract to a variable.",
|
|
358
|
+
"examples": [
|
|
359
|
+
"no-nested-template-literals: warn"
|
|
360
|
+
],
|
|
361
|
+
"anyOf": [
|
|
362
|
+
{
|
|
363
|
+
"type": "string",
|
|
364
|
+
"enum": [
|
|
365
|
+
"error",
|
|
366
|
+
"warn",
|
|
367
|
+
"off"
|
|
368
|
+
],
|
|
369
|
+
"description": "Rule severity. \"error\" exits with code 2; \"warn\" reports but exits 0; \"off\" silences."
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
"type": "object",
|
|
373
|
+
"properties": {
|
|
374
|
+
"severity": {
|
|
375
|
+
"type": "string",
|
|
376
|
+
"enum": [
|
|
377
|
+
"error",
|
|
378
|
+
"warn",
|
|
379
|
+
"off"
|
|
380
|
+
],
|
|
381
|
+
"description": "Rule severity. \"error\" exits with code 2; \"warn\" reports but exits 0; \"off\" silences."
|
|
382
|
+
},
|
|
383
|
+
"include": {
|
|
384
|
+
"description": "Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: [\"src/hooks/**\", \"!src/hooks/scripts/**\"]",
|
|
385
|
+
"type": "array",
|
|
386
|
+
"items": {
|
|
387
|
+
"type": "string"
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
"additionalProperties": false,
|
|
392
|
+
"description": "Rule options object. Omit severity to default to \"error\". Add include to scope the rule to specific files."
|
|
393
|
+
}
|
|
394
|
+
]
|
|
395
|
+
},
|
|
396
|
+
"no-consecutive-array-push": {
|
|
397
|
+
"description": "Flags consecutive `arr.push(x); arr.push(y);` calls — combine into `arr.push(x, y)` or `arr.push(...items)`.",
|
|
398
|
+
"examples": [
|
|
399
|
+
"no-consecutive-array-push: warn"
|
|
400
|
+
],
|
|
401
|
+
"anyOf": [
|
|
402
|
+
{
|
|
403
|
+
"type": "string",
|
|
404
|
+
"enum": [
|
|
405
|
+
"error",
|
|
406
|
+
"warn",
|
|
407
|
+
"off"
|
|
408
|
+
],
|
|
409
|
+
"description": "Rule severity. \"error\" exits with code 2; \"warn\" reports but exits 0; \"off\" silences."
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
"type": "object",
|
|
413
|
+
"properties": {
|
|
414
|
+
"severity": {
|
|
415
|
+
"type": "string",
|
|
416
|
+
"enum": [
|
|
417
|
+
"error",
|
|
418
|
+
"warn",
|
|
419
|
+
"off"
|
|
420
|
+
],
|
|
421
|
+
"description": "Rule severity. \"error\" exits with code 2; \"warn\" reports but exits 0; \"off\" silences."
|
|
422
|
+
},
|
|
423
|
+
"include": {
|
|
424
|
+
"description": "Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: [\"src/hooks/**\", \"!src/hooks/scripts/**\"]",
|
|
425
|
+
"type": "array",
|
|
426
|
+
"items": {
|
|
427
|
+
"type": "string"
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
},
|
|
431
|
+
"additionalProperties": false,
|
|
432
|
+
"description": "Rule options object. Omit severity to default to \"error\". Add include to scope the rule to specific files."
|
|
433
|
+
}
|
|
434
|
+
]
|
|
435
|
+
},
|
|
436
|
+
"no-string-match": {
|
|
437
|
+
"description": "Flags `String#match` — prefer `.matchAll()` for iteration or `.test()` for boolean checks. `.match()` returns different shapes depending on the `/g` flag.",
|
|
438
|
+
"examples": [
|
|
439
|
+
"no-string-match: error"
|
|
440
|
+
],
|
|
441
|
+
"anyOf": [
|
|
442
|
+
{
|
|
443
|
+
"type": "string",
|
|
444
|
+
"enum": [
|
|
445
|
+
"error",
|
|
446
|
+
"warn",
|
|
447
|
+
"off"
|
|
448
|
+
],
|
|
449
|
+
"description": "Rule severity. \"error\" exits with code 2; \"warn\" reports but exits 0; \"off\" silences."
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
"type": "object",
|
|
453
|
+
"properties": {
|
|
454
|
+
"severity": {
|
|
455
|
+
"type": "string",
|
|
456
|
+
"enum": [
|
|
457
|
+
"error",
|
|
458
|
+
"warn",
|
|
459
|
+
"off"
|
|
460
|
+
],
|
|
461
|
+
"description": "Rule severity. \"error\" exits with code 2; \"warn\" reports but exits 0; \"off\" silences."
|
|
462
|
+
},
|
|
463
|
+
"include": {
|
|
464
|
+
"description": "Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: [\"src/hooks/**\", \"!src/hooks/scripts/**\"]",
|
|
465
|
+
"type": "array",
|
|
466
|
+
"items": {
|
|
467
|
+
"type": "string"
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
},
|
|
471
|
+
"additionalProperties": false,
|
|
472
|
+
"description": "Rule options object. Omit severity to default to \"error\". Add include to scope the rule to specific files."
|
|
473
|
+
}
|
|
474
|
+
]
|
|
475
|
+
},
|
|
476
|
+
"sonar/prefer-string-replaceall": {
|
|
477
|
+
"description": "Flags `.replace(/x/g, y)` on strings — `.replaceAll('x', y)` is clearer and faster for all-occurrence replacements.",
|
|
478
|
+
"examples": [
|
|
479
|
+
"sonar/prefer-string-replaceall: error"
|
|
480
|
+
],
|
|
481
|
+
"anyOf": [
|
|
482
|
+
{
|
|
483
|
+
"type": "string",
|
|
484
|
+
"enum": [
|
|
485
|
+
"error",
|
|
486
|
+
"warn",
|
|
487
|
+
"off"
|
|
488
|
+
],
|
|
489
|
+
"description": "Rule severity. \"error\" exits with code 2; \"warn\" reports but exits 0; \"off\" silences."
|
|
490
|
+
},
|
|
491
|
+
{
|
|
492
|
+
"type": "object",
|
|
493
|
+
"properties": {
|
|
494
|
+
"severity": {
|
|
495
|
+
"type": "string",
|
|
496
|
+
"enum": [
|
|
497
|
+
"error",
|
|
498
|
+
"warn",
|
|
499
|
+
"off"
|
|
500
|
+
],
|
|
501
|
+
"description": "Rule severity. \"error\" exits with code 2; \"warn\" reports but exits 0; \"off\" silences."
|
|
502
|
+
},
|
|
503
|
+
"include": {
|
|
504
|
+
"description": "Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: [\"src/hooks/**\", \"!src/hooks/scripts/**\"]",
|
|
505
|
+
"type": "array",
|
|
506
|
+
"items": {
|
|
507
|
+
"type": "string"
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
},
|
|
511
|
+
"additionalProperties": false,
|
|
512
|
+
"description": "Rule options object. Omit severity to default to \"error\". Add include to scope the rule to specific files."
|
|
513
|
+
}
|
|
514
|
+
]
|
|
515
|
+
},
|
|
516
|
+
"sonar/prefer-string-raw-regexp": {
|
|
517
|
+
"description": "Flags regex literals built from escape-heavy string concatenation — `String.raw` drops the double backslashes.",
|
|
518
|
+
"examples": [
|
|
519
|
+
"sonar/prefer-string-raw-regexp: warn"
|
|
520
|
+
],
|
|
521
|
+
"anyOf": [
|
|
522
|
+
{
|
|
523
|
+
"type": "string",
|
|
524
|
+
"enum": [
|
|
525
|
+
"error",
|
|
526
|
+
"warn",
|
|
527
|
+
"off"
|
|
528
|
+
],
|
|
529
|
+
"description": "Rule severity. \"error\" exits with code 2; \"warn\" reports but exits 0; \"off\" silences."
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
"type": "object",
|
|
533
|
+
"properties": {
|
|
534
|
+
"severity": {
|
|
535
|
+
"type": "string",
|
|
536
|
+
"enum": [
|
|
537
|
+
"error",
|
|
538
|
+
"warn",
|
|
539
|
+
"off"
|
|
540
|
+
],
|
|
541
|
+
"description": "Rule severity. \"error\" exits with code 2; \"warn\" reports but exits 0; \"off\" silences."
|
|
542
|
+
},
|
|
543
|
+
"include": {
|
|
544
|
+
"description": "Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: [\"src/hooks/**\", \"!src/hooks/scripts/**\"]",
|
|
545
|
+
"type": "array",
|
|
546
|
+
"items": {
|
|
547
|
+
"type": "string"
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
},
|
|
551
|
+
"additionalProperties": false,
|
|
552
|
+
"description": "Rule options object. Omit severity to default to \"error\". Add include to scope the rule to specific files."
|
|
553
|
+
}
|
|
554
|
+
]
|
|
555
|
+
},
|
|
556
|
+
"sonar/prefer-string-raw": {
|
|
557
|
+
"description": "Flags string literals with multiple backslash escapes — `String.raw` is more readable (Windows paths, regex source, etc.).",
|
|
558
|
+
"examples": [
|
|
559
|
+
"sonar/prefer-string-raw: warn"
|
|
560
|
+
],
|
|
561
|
+
"anyOf": [
|
|
562
|
+
{
|
|
563
|
+
"type": "string",
|
|
564
|
+
"enum": [
|
|
565
|
+
"error",
|
|
566
|
+
"warn",
|
|
567
|
+
"off"
|
|
568
|
+
],
|
|
569
|
+
"description": "Rule severity. \"error\" exits with code 2; \"warn\" reports but exits 0; \"off\" silences."
|
|
570
|
+
},
|
|
571
|
+
{
|
|
572
|
+
"type": "object",
|
|
573
|
+
"properties": {
|
|
574
|
+
"severity": {
|
|
575
|
+
"type": "string",
|
|
576
|
+
"enum": [
|
|
577
|
+
"error",
|
|
578
|
+
"warn",
|
|
579
|
+
"off"
|
|
580
|
+
],
|
|
581
|
+
"description": "Rule severity. \"error\" exits with code 2; \"warn\" reports but exits 0; \"off\" silences."
|
|
582
|
+
},
|
|
583
|
+
"include": {
|
|
584
|
+
"description": "Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: [\"src/hooks/**\", \"!src/hooks/scripts/**\"]",
|
|
585
|
+
"type": "array",
|
|
586
|
+
"items": {
|
|
587
|
+
"type": "string"
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
},
|
|
591
|
+
"additionalProperties": false,
|
|
592
|
+
"description": "Rule options object. Omit severity to default to \"error\". Add include to scope the rule to specific files."
|
|
593
|
+
}
|
|
594
|
+
]
|
|
595
|
+
},
|
|
596
|
+
"sonar/prefer-nullish-coalescing-assign": {
|
|
597
|
+
"description": "Flags explicit nullish assignment guards — `x ??= y` is the dedicated nullish assignment operator.",
|
|
598
|
+
"examples": [
|
|
599
|
+
"sonar/prefer-nullish-coalescing-assign: warn"
|
|
600
|
+
],
|
|
601
|
+
"anyOf": [
|
|
602
|
+
{
|
|
603
|
+
"type": "string",
|
|
604
|
+
"enum": [
|
|
605
|
+
"error",
|
|
606
|
+
"warn",
|
|
607
|
+
"off"
|
|
608
|
+
],
|
|
609
|
+
"description": "Rule severity. \"error\" exits with code 2; \"warn\" reports but exits 0; \"off\" silences."
|
|
610
|
+
},
|
|
611
|
+
{
|
|
612
|
+
"type": "object",
|
|
613
|
+
"properties": {
|
|
614
|
+
"severity": {
|
|
615
|
+
"type": "string",
|
|
616
|
+
"enum": [
|
|
617
|
+
"error",
|
|
618
|
+
"warn",
|
|
619
|
+
"off"
|
|
620
|
+
],
|
|
621
|
+
"description": "Rule severity. \"error\" exits with code 2; \"warn\" reports but exits 0; \"off\" silences."
|
|
622
|
+
},
|
|
623
|
+
"include": {
|
|
624
|
+
"description": "Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: [\"src/hooks/**\", \"!src/hooks/scripts/**\"]",
|
|
625
|
+
"type": "array",
|
|
626
|
+
"items": {
|
|
627
|
+
"type": "string"
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
},
|
|
631
|
+
"additionalProperties": false,
|
|
632
|
+
"description": "Rule options object. Omit severity to default to \"error\". Add include to scope the rule to specific files."
|
|
633
|
+
}
|
|
634
|
+
]
|
|
635
|
+
},
|
|
636
|
+
"sonar/no-single-char-class": {
|
|
637
|
+
"description": "Flags single-character character classes in regex (e.g. `/[a]/`) — drop the brackets; the regex matches the same.",
|
|
638
|
+
"examples": [
|
|
639
|
+
"sonar/no-single-char-class: warn"
|
|
640
|
+
],
|
|
641
|
+
"anyOf": [
|
|
642
|
+
{
|
|
643
|
+
"type": "string",
|
|
644
|
+
"enum": [
|
|
645
|
+
"error",
|
|
646
|
+
"warn",
|
|
647
|
+
"off"
|
|
648
|
+
],
|
|
649
|
+
"description": "Rule severity. \"error\" exits with code 2; \"warn\" reports but exits 0; \"off\" silences."
|
|
650
|
+
},
|
|
651
|
+
{
|
|
652
|
+
"type": "object",
|
|
653
|
+
"properties": {
|
|
654
|
+
"severity": {
|
|
655
|
+
"type": "string",
|
|
656
|
+
"enum": [
|
|
657
|
+
"error",
|
|
658
|
+
"warn",
|
|
659
|
+
"off"
|
|
660
|
+
],
|
|
661
|
+
"description": "Rule severity. \"error\" exits with code 2; \"warn\" reports but exits 0; \"off\" silences."
|
|
662
|
+
},
|
|
663
|
+
"include": {
|
|
664
|
+
"description": "Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: [\"src/hooks/**\", \"!src/hooks/scripts/**\"]",
|
|
665
|
+
"type": "array",
|
|
666
|
+
"items": {
|
|
667
|
+
"type": "string"
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
},
|
|
671
|
+
"additionalProperties": false,
|
|
672
|
+
"description": "Rule options object. Omit severity to default to \"error\". Add include to scope the rule to specific files."
|
|
673
|
+
}
|
|
674
|
+
]
|
|
675
|
+
},
|
|
676
|
+
"sonar/prefer-at": {
|
|
677
|
+
"description": "Flags negative-index access via `arr[arr.length - 1]` — `.at(-1)` reads cleaner for last-element access.",
|
|
678
|
+
"examples": [
|
|
679
|
+
"sonar/prefer-at: warn"
|
|
680
|
+
],
|
|
681
|
+
"anyOf": [
|
|
682
|
+
{
|
|
683
|
+
"type": "string",
|
|
684
|
+
"enum": [
|
|
685
|
+
"error",
|
|
686
|
+
"warn",
|
|
687
|
+
"off"
|
|
688
|
+
],
|
|
689
|
+
"description": "Rule severity. \"error\" exits with code 2; \"warn\" reports but exits 0; \"off\" silences."
|
|
690
|
+
},
|
|
691
|
+
{
|
|
692
|
+
"type": "object",
|
|
693
|
+
"properties": {
|
|
694
|
+
"severity": {
|
|
695
|
+
"type": "string",
|
|
696
|
+
"enum": [
|
|
697
|
+
"error",
|
|
698
|
+
"warn",
|
|
699
|
+
"off"
|
|
700
|
+
],
|
|
701
|
+
"description": "Rule severity. \"error\" exits with code 2; \"warn\" reports but exits 0; \"off\" silences."
|
|
702
|
+
},
|
|
703
|
+
"include": {
|
|
704
|
+
"description": "Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: [\"src/hooks/**\", \"!src/hooks/scripts/**\"]",
|
|
705
|
+
"type": "array",
|
|
706
|
+
"items": {
|
|
707
|
+
"type": "string"
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
},
|
|
711
|
+
"additionalProperties": false,
|
|
712
|
+
"description": "Rule options object. Omit severity to default to \"error\". Add include to scope the rule to specific files."
|
|
713
|
+
}
|
|
714
|
+
]
|
|
715
|
+
}
|
|
716
|
+
},
|
|
717
|
+
"additionalProperties": {
|
|
718
|
+
"anyOf": [
|
|
719
|
+
{
|
|
720
|
+
"type": "string",
|
|
721
|
+
"enum": [
|
|
722
|
+
"error",
|
|
723
|
+
"warn",
|
|
724
|
+
"off"
|
|
725
|
+
],
|
|
726
|
+
"description": "Rule severity. \"error\" exits with code 2; \"warn\" reports but exits 0; \"off\" silences."
|
|
727
|
+
},
|
|
728
|
+
{
|
|
729
|
+
"type": "object",
|
|
730
|
+
"properties": {
|
|
731
|
+
"severity": {
|
|
732
|
+
"type": "string",
|
|
733
|
+
"enum": [
|
|
734
|
+
"error",
|
|
735
|
+
"warn",
|
|
736
|
+
"off"
|
|
737
|
+
],
|
|
738
|
+
"description": "Rule severity. \"error\" exits with code 2; \"warn\" reports but exits 0; \"off\" silences."
|
|
739
|
+
},
|
|
740
|
+
"include": {
|
|
741
|
+
"description": "Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: [\"src/hooks/**\", \"!src/hooks/scripts/**\"]",
|
|
742
|
+
"type": "array",
|
|
743
|
+
"items": {
|
|
744
|
+
"type": "string"
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
},
|
|
748
|
+
"additionalProperties": false,
|
|
749
|
+
"description": "Rule options object. Omit severity to default to \"error\". Add include to scope the rule to specific files."
|
|
750
|
+
}
|
|
751
|
+
]
|
|
752
|
+
}
|
|
753
|
+
},
|
|
754
|
+
"arch": {
|
|
755
|
+
"type": "object",
|
|
756
|
+
"properties": {
|
|
757
|
+
"layers": {
|
|
758
|
+
"type": "object",
|
|
759
|
+
"propertyNames": {
|
|
760
|
+
"type": "string"
|
|
761
|
+
},
|
|
762
|
+
"additionalProperties": {
|
|
763
|
+
"type": "array",
|
|
764
|
+
"items": {
|
|
765
|
+
"type": "string"
|
|
766
|
+
}
|
|
767
|
+
},
|
|
768
|
+
"description": "Named architectural zones. Keys are arbitrary layer names; values are glob patterns matching the files in that layer. Other arch rules reference these names instead of repeating globs.",
|
|
769
|
+
"examples": [
|
|
770
|
+
"layers:\n core: [\"src/hooks/lib/**\", \"src/tools/**\"]\n skills: [\"assets/skills/**\"]\n dao: [\"src/dao/**\"]"
|
|
771
|
+
]
|
|
772
|
+
},
|
|
773
|
+
"imports": {
|
|
774
|
+
"description": "Import-boundary rules. The dependency graph your README claims you have.",
|
|
775
|
+
"type": "array",
|
|
776
|
+
"items": {
|
|
777
|
+
"type": "object",
|
|
778
|
+
"properties": {
|
|
779
|
+
"from": {
|
|
780
|
+
"anyOf": [
|
|
781
|
+
{
|
|
782
|
+
"type": "string"
|
|
783
|
+
},
|
|
784
|
+
{
|
|
785
|
+
"type": "array",
|
|
786
|
+
"items": {
|
|
787
|
+
"type": "string"
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
],
|
|
791
|
+
"description": "Source — a layer name or glob(s) for the files this rule applies to. Imports originating in `from` are checked against `deny`/`allow`."
|
|
792
|
+
},
|
|
793
|
+
"deny": {
|
|
794
|
+
"description": "Layer name(s) or glob(s) the source is not allowed to import from. Mutually exclusive in spirit with `allow` (use one or the other).",
|
|
795
|
+
"anyOf": [
|
|
796
|
+
{
|
|
797
|
+
"type": "string"
|
|
798
|
+
},
|
|
799
|
+
{
|
|
800
|
+
"type": "array",
|
|
801
|
+
"items": {
|
|
802
|
+
"type": "string"
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
]
|
|
806
|
+
},
|
|
807
|
+
"allow": {
|
|
808
|
+
"description": "Allowlist of layer name(s) / glob(s) the source may import from. Anything not matching `allow` is denied.",
|
|
809
|
+
"anyOf": [
|
|
810
|
+
{
|
|
811
|
+
"type": "string"
|
|
812
|
+
},
|
|
813
|
+
{
|
|
814
|
+
"type": "array",
|
|
815
|
+
"items": {
|
|
816
|
+
"type": "string"
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
]
|
|
820
|
+
},
|
|
821
|
+
"deny-packages": {
|
|
822
|
+
"description": "Package specifier(s) the source is not allowed to import — npm packages, `node:` builtins, Python pip packages and stdlib modules, Swift system frameworks, external Rust crates, and C# namespaces or NuGet packages, which `deny`/`allow` cannot reach because they never resolve to a project file. Matching is per segment: `/` in TypeScript/JavaScript, so `next` also covers `next/headers` while `nextra` is unaffected; `.` in Python, Swift, and C#, so `os` also covers `os.path` while `oscrypto` is unaffected; and `::` in Rust, so `tokio` also covers `tokio::sync::Mutex` while `tokio_util` is unaffected. Python, Swift, Rust, and C# sources are checked by the Rust engine.",
|
|
823
|
+
"anyOf": [
|
|
824
|
+
{
|
|
825
|
+
"type": "string"
|
|
826
|
+
},
|
|
827
|
+
{
|
|
828
|
+
"type": "array",
|
|
829
|
+
"items": {
|
|
830
|
+
"type": "string"
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
]
|
|
834
|
+
},
|
|
835
|
+
"type-only": {
|
|
836
|
+
"description": "When set to \"allow\", `import type` statements that would otherwise be denied are permitted. In Python, imports inside an `if TYPE_CHECKING:` block are exempted the same way. Useful for type-only references across layers.",
|
|
837
|
+
"type": "string",
|
|
838
|
+
"const": "allow"
|
|
839
|
+
},
|
|
840
|
+
"message": {
|
|
841
|
+
"description": "Custom error message reported when the rule is violated. Shown in the agent's event stream alongside file:line.",
|
|
842
|
+
"type": "string"
|
|
843
|
+
},
|
|
844
|
+
"severity": {
|
|
845
|
+
"type": "string",
|
|
846
|
+
"enum": [
|
|
847
|
+
"error",
|
|
848
|
+
"warn"
|
|
849
|
+
],
|
|
850
|
+
"description": "Severity for the arch rule. \"error\" exits with code 2; \"warn\" reports but exits 0. (arch rules cannot be \"off\" — remove the entry instead.)"
|
|
851
|
+
}
|
|
852
|
+
},
|
|
853
|
+
"required": [
|
|
854
|
+
"from"
|
|
855
|
+
],
|
|
856
|
+
"additionalProperties": false,
|
|
857
|
+
"description": "An import-boundary rule. Restricts which layers a source can or cannot import from.",
|
|
858
|
+
"examples": [
|
|
859
|
+
"arch:\n imports:\n - from: skills\n deny: core\n message: \"Skills must be self-contained and portable\"\n severity: warn",
|
|
860
|
+
"arch:\n imports:\n - from: [\"src/dao/**\"]\n allow: [\"src/dao/**\", \"src/prisma/**\", \"src/types/**\"]"
|
|
861
|
+
]
|
|
862
|
+
}
|
|
863
|
+
},
|
|
864
|
+
"forbidden": {
|
|
865
|
+
"description": "Forbidden-pattern rules. Block literal strings scoped to a layer.",
|
|
866
|
+
"type": "array",
|
|
867
|
+
"items": {
|
|
868
|
+
"anyOf": [
|
|
869
|
+
{
|
|
870
|
+
"type": "object",
|
|
871
|
+
"properties": {
|
|
872
|
+
"pattern": {
|
|
873
|
+
"type": "string",
|
|
874
|
+
"description": "Pattern to search for, scanned per line. A literal substring by default (e.g. a console logging call). Prefix with `re:` to match a regular expression instead (e.g. `re:\\bp-\\[\\d+px\\]`). Regexes must use the common JS/RE2 subset — no lookaround or backreferences — so the TS and Rust engines agree. Note: a literal pattern that itself begins with `re:` cannot be expressed; such a value is always read as a regex."
|
|
875
|
+
},
|
|
876
|
+
"in": {
|
|
877
|
+
"anyOf": [
|
|
878
|
+
{
|
|
879
|
+
"type": "string"
|
|
880
|
+
},
|
|
881
|
+
{
|
|
882
|
+
"type": "array",
|
|
883
|
+
"items": {
|
|
884
|
+
"type": "string"
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
],
|
|
888
|
+
"description": "Layer name(s) or glob(s) the pattern is forbidden in. Files outside the scope are not checked."
|
|
889
|
+
},
|
|
890
|
+
"message": {
|
|
891
|
+
"type": "string",
|
|
892
|
+
"description": "Required error message explaining why the pattern is forbidden. Shown to the agent so it can fix the call site."
|
|
893
|
+
},
|
|
894
|
+
"severity": {
|
|
895
|
+
"type": "string",
|
|
896
|
+
"enum": [
|
|
897
|
+
"error",
|
|
898
|
+
"warn"
|
|
899
|
+
],
|
|
900
|
+
"description": "Severity for the arch rule. \"error\" exits with code 2; \"warn\" reports but exits 0. (arch rules cannot be \"off\" — remove the entry instead.)"
|
|
901
|
+
}
|
|
902
|
+
},
|
|
903
|
+
"required": [
|
|
904
|
+
"pattern",
|
|
905
|
+
"in",
|
|
906
|
+
"message"
|
|
907
|
+
],
|
|
908
|
+
"additionalProperties": false
|
|
909
|
+
},
|
|
910
|
+
{
|
|
911
|
+
"type": "object",
|
|
912
|
+
"properties": {
|
|
913
|
+
"jsx-element": {
|
|
914
|
+
"anyOf": [
|
|
915
|
+
{
|
|
916
|
+
"type": "string"
|
|
917
|
+
},
|
|
918
|
+
{
|
|
919
|
+
"type": "array",
|
|
920
|
+
"items": {
|
|
921
|
+
"type": "string"
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
],
|
|
925
|
+
"description": "JSX intrinsic element name(s) to forbid (e.g. `button`, `input`, `label`). AST-matched on opening and self-closing tag names — robust to whitespace, attributes, and naming collisions like `<buttonGroup>`."
|
|
926
|
+
},
|
|
927
|
+
"in": {
|
|
928
|
+
"anyOf": [
|
|
929
|
+
{
|
|
930
|
+
"type": "string"
|
|
931
|
+
},
|
|
932
|
+
{
|
|
933
|
+
"type": "array",
|
|
934
|
+
"items": {
|
|
935
|
+
"type": "string"
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
],
|
|
939
|
+
"description": "Layer name(s) or glob(s) the element is forbidden in. Files outside the scope are not checked."
|
|
940
|
+
},
|
|
941
|
+
"message": {
|
|
942
|
+
"type": "string",
|
|
943
|
+
"description": "Required error message explaining why the raw element is forbidden. Typically points at the design-system replacement (e.g. `Use <Button /> from @/components/ui/button`)."
|
|
944
|
+
},
|
|
945
|
+
"severity": {
|
|
946
|
+
"type": "string",
|
|
947
|
+
"enum": [
|
|
948
|
+
"error",
|
|
949
|
+
"warn"
|
|
950
|
+
],
|
|
951
|
+
"description": "Severity for the arch rule. \"error\" exits with code 2; \"warn\" reports but exits 0. (arch rules cannot be \"off\" — remove the entry instead.)"
|
|
952
|
+
}
|
|
953
|
+
},
|
|
954
|
+
"required": [
|
|
955
|
+
"jsx-element",
|
|
956
|
+
"in",
|
|
957
|
+
"message"
|
|
958
|
+
],
|
|
959
|
+
"additionalProperties": false
|
|
960
|
+
}
|
|
961
|
+
],
|
|
962
|
+
"description": "A forbidden-pattern rule. Blocks either a literal substring (`pattern:`) or a JSX element (`jsx-element:`) inside specific layers.",
|
|
963
|
+
"examples": [
|
|
964
|
+
"arch:\n forbidden:\n - pattern: \"debugLog(\"\n in: core\n message: \"Leaks into the agent event stream\"",
|
|
965
|
+
"arch:\n forbidden:\n - jsx-element: [\"button\", \"input\", \"label\"]\n in: [\"src/app/**/*.tsx\", \"src/components/**/*.tsx\", \"!src/components/ui/**\"]\n message: \"Use the design-system primitives in @/components/ui/* instead of raw HTML elements.\""
|
|
966
|
+
]
|
|
967
|
+
}
|
|
968
|
+
},
|
|
969
|
+
"singleton": {
|
|
970
|
+
"description": "Singleton-location rules. Pin a pattern to one file; every other touch is a violation.",
|
|
971
|
+
"type": "array",
|
|
972
|
+
"items": {
|
|
973
|
+
"anyOf": [
|
|
974
|
+
{
|
|
975
|
+
"type": "object",
|
|
976
|
+
"properties": {
|
|
977
|
+
"pattern": {
|
|
978
|
+
"type": "string",
|
|
979
|
+
"description": "Pattern whose appearance is allowed only at one location, scanned per line. A literal substring by default (e.g. `process.env.API_KEY`). Prefix with `re:` to match a regular expression instead. Regexes must use the common JS/RE2 subset — no lookaround or backreferences — so the TS and Rust engines agree. Note: a literal pattern that itself begins with `re:` cannot be expressed; such a value is always read as a regex."
|
|
980
|
+
},
|
|
981
|
+
"only": {
|
|
982
|
+
"type": "string",
|
|
983
|
+
"description": "The single file path where this pattern is allowed. Every other occurrence becomes a violation."
|
|
984
|
+
},
|
|
985
|
+
"in": {
|
|
986
|
+
"description": "Optional scope. Limit the scan to these layers/globs; defaults to all files in `include`.",
|
|
987
|
+
"anyOf": [
|
|
988
|
+
{
|
|
989
|
+
"type": "string"
|
|
990
|
+
},
|
|
991
|
+
{
|
|
992
|
+
"type": "array",
|
|
993
|
+
"items": {
|
|
994
|
+
"type": "string"
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
]
|
|
998
|
+
},
|
|
999
|
+
"message": {
|
|
1000
|
+
"type": "string"
|
|
1001
|
+
},
|
|
1002
|
+
"severity": {
|
|
1003
|
+
"type": "string",
|
|
1004
|
+
"enum": [
|
|
1005
|
+
"error",
|
|
1006
|
+
"warn"
|
|
1007
|
+
],
|
|
1008
|
+
"description": "Severity for the arch rule. \"error\" exits with code 2; \"warn\" reports but exits 0. (arch rules cannot be \"off\" — remove the entry instead.)"
|
|
1009
|
+
}
|
|
1010
|
+
},
|
|
1011
|
+
"required": [
|
|
1012
|
+
"pattern",
|
|
1013
|
+
"only",
|
|
1014
|
+
"message"
|
|
1015
|
+
],
|
|
1016
|
+
"additionalProperties": false
|
|
1017
|
+
},
|
|
1018
|
+
{
|
|
1019
|
+
"type": "object",
|
|
1020
|
+
"properties": {
|
|
1021
|
+
"jsx-element": {
|
|
1022
|
+
"anyOf": [
|
|
1023
|
+
{
|
|
1024
|
+
"type": "string"
|
|
1025
|
+
},
|
|
1026
|
+
{
|
|
1027
|
+
"type": "array",
|
|
1028
|
+
"items": {
|
|
1029
|
+
"type": "string"
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
],
|
|
1033
|
+
"description": "JSX intrinsic element name(s) allowed only inside the `only` file. AST-matched on tag names."
|
|
1034
|
+
},
|
|
1035
|
+
"only": {
|
|
1036
|
+
"type": "string",
|
|
1037
|
+
"description": "The single file path where the element is allowed (typically the design-system primitive that wraps it)."
|
|
1038
|
+
},
|
|
1039
|
+
"in": {
|
|
1040
|
+
"anyOf": [
|
|
1041
|
+
{
|
|
1042
|
+
"type": "string"
|
|
1043
|
+
},
|
|
1044
|
+
{
|
|
1045
|
+
"type": "array",
|
|
1046
|
+
"items": {
|
|
1047
|
+
"type": "string"
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
],
|
|
1051
|
+
"description": "Either a single layer name / glob pattern or an array of them. Layer names defined in `arch.layers` are resolved to their glob lists."
|
|
1052
|
+
},
|
|
1053
|
+
"message": {
|
|
1054
|
+
"type": "string"
|
|
1055
|
+
},
|
|
1056
|
+
"severity": {
|
|
1057
|
+
"type": "string",
|
|
1058
|
+
"enum": [
|
|
1059
|
+
"error",
|
|
1060
|
+
"warn"
|
|
1061
|
+
],
|
|
1062
|
+
"description": "Severity for the arch rule. \"error\" exits with code 2; \"warn\" reports but exits 0. (arch rules cannot be \"off\" — remove the entry instead.)"
|
|
1063
|
+
}
|
|
1064
|
+
},
|
|
1065
|
+
"required": [
|
|
1066
|
+
"jsx-element",
|
|
1067
|
+
"only",
|
|
1068
|
+
"message"
|
|
1069
|
+
],
|
|
1070
|
+
"additionalProperties": false
|
|
1071
|
+
}
|
|
1072
|
+
],
|
|
1073
|
+
"description": "A singleton-location rule. Pins a pattern or JSX element to exactly one file — the only honest way to enforce a module of record or a design-system primitive.",
|
|
1074
|
+
"examples": [
|
|
1075
|
+
"arch:\n singleton:\n - pattern: \"process.env.API_KEY\"\n only: \"src/lib/auth.ts\"\n message: \"API key access must funnel through the auth module.\"",
|
|
1076
|
+
"arch:\n singleton:\n - jsx-element: \"button\"\n only: \"src/components/ui/button.tsx\"\n in: [\"src/**/*.tsx\"]\n message: \"Raw <button> belongs only to the Button primitive.\""
|
|
1077
|
+
]
|
|
1078
|
+
}
|
|
1079
|
+
},
|
|
1080
|
+
"maxLines": {
|
|
1081
|
+
"description": "Per-file line-count limits. Cap how long files in a layer may grow, with different ceilings per scope.",
|
|
1082
|
+
"type": "array",
|
|
1083
|
+
"items": {
|
|
1084
|
+
"type": "object",
|
|
1085
|
+
"properties": {
|
|
1086
|
+
"limit": {
|
|
1087
|
+
"type": "integer",
|
|
1088
|
+
"exclusiveMinimum": 0,
|
|
1089
|
+
"maximum": 9007199254740991,
|
|
1090
|
+
"description": "Maximum number of physical lines a file may contain. Counts every line including blanks and comments. A file with more lines than this is a violation."
|
|
1091
|
+
},
|
|
1092
|
+
"in": {
|
|
1093
|
+
"anyOf": [
|
|
1094
|
+
{
|
|
1095
|
+
"type": "string"
|
|
1096
|
+
},
|
|
1097
|
+
{
|
|
1098
|
+
"type": "array",
|
|
1099
|
+
"items": {
|
|
1100
|
+
"type": "string"
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
],
|
|
1104
|
+
"description": "Layer name(s) or glob(s) the limit applies to. Files outside the scope are not checked."
|
|
1105
|
+
},
|
|
1106
|
+
"message": {
|
|
1107
|
+
"description": "Optional error message. Defaults to a message naming the limit (e.g. 'File exceeds the maximum of 300 lines').",
|
|
1108
|
+
"type": "string"
|
|
1109
|
+
},
|
|
1110
|
+
"severity": {
|
|
1111
|
+
"type": "string",
|
|
1112
|
+
"enum": [
|
|
1113
|
+
"error",
|
|
1114
|
+
"warn"
|
|
1115
|
+
],
|
|
1116
|
+
"description": "Severity for the arch rule. \"error\" exits with code 2; \"warn\" reports but exits 0. (arch rules cannot be \"off\" — remove the entry instead.)"
|
|
1117
|
+
}
|
|
1118
|
+
},
|
|
1119
|
+
"required": [
|
|
1120
|
+
"limit",
|
|
1121
|
+
"in"
|
|
1122
|
+
],
|
|
1123
|
+
"additionalProperties": false,
|
|
1124
|
+
"description": "A per-file line-count limit. Caps how long any file in scope may grow — the honest way to keep modules small without a formatter dependency.",
|
|
1125
|
+
"examples": [
|
|
1126
|
+
"arch:\n maxLines:\n - limit: 300\n in: src/**\n message: \"Split this module\"",
|
|
1127
|
+
"arch:\n maxLines:\n - limit: 300\n in: src/**\n - limit: 600\n in: tests/**"
|
|
1128
|
+
]
|
|
1129
|
+
}
|
|
1130
|
+
},
|
|
1131
|
+
"maxCommentDensity": {
|
|
1132
|
+
"description": "Per-file comment-density ceilings. Cap the share of a file that may be explanatory comments; doc-comments are exempt by default.",
|
|
1133
|
+
"type": "array",
|
|
1134
|
+
"items": {
|
|
1135
|
+
"type": "object",
|
|
1136
|
+
"properties": {
|
|
1137
|
+
"limit": {
|
|
1138
|
+
"type": "number",
|
|
1139
|
+
"exclusiveMinimum": 0,
|
|
1140
|
+
"maximum": 100,
|
|
1141
|
+
"description": "Maximum percentage of a file's physical lines that may be comment lines. Denominator is total physical lines (code + comments + blanks), the same count `maxLines` uses. A file above this ratio is a violation."
|
|
1142
|
+
},
|
|
1143
|
+
"countDocComments": {
|
|
1144
|
+
"description": "Count doc-comments toward the limit. Doc-comments are `/** … */` JSDoc blocks (TS/JS), `///` (Swift and C#), and `///` or `//!` (Rust); ordinary `//`, `/* */`, and `#` comments are always counted. Defaults to false, so documentation is exempt and only explanatory/inline comments are capped. Has no effect on Python: docstrings are string expressions rather than comments, so they never count toward either limit.",
|
|
1145
|
+
"type": "boolean"
|
|
1146
|
+
},
|
|
1147
|
+
"ignore": {
|
|
1148
|
+
"description": "Comment lines matching these patterns are structural, not prose — marker comments a build or codegen step reads, for example — and count toward neither limit. A literal substring by default; prefix with `re:` for a regex. Ignored lines still count in the density denominator (they are physical lines) and still hold a comment block together, so a marker cannot be used to split an over-tall block.",
|
|
1149
|
+
"anyOf": [
|
|
1150
|
+
{
|
|
1151
|
+
"type": "string"
|
|
1152
|
+
},
|
|
1153
|
+
{
|
|
1154
|
+
"type": "array",
|
|
1155
|
+
"items": {
|
|
1156
|
+
"type": "string"
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
]
|
|
1160
|
+
},
|
|
1161
|
+
"in": {
|
|
1162
|
+
"anyOf": [
|
|
1163
|
+
{
|
|
1164
|
+
"type": "string"
|
|
1165
|
+
},
|
|
1166
|
+
{
|
|
1167
|
+
"type": "array",
|
|
1168
|
+
"items": {
|
|
1169
|
+
"type": "string"
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
],
|
|
1173
|
+
"description": "Layer name(s) or glob(s) the limit applies to. Files outside the scope are not checked."
|
|
1174
|
+
},
|
|
1175
|
+
"message": {
|
|
1176
|
+
"description": "Optional error message. Defaults to a message naming the measured density and the limit.",
|
|
1177
|
+
"type": "string"
|
|
1178
|
+
},
|
|
1179
|
+
"severity": {
|
|
1180
|
+
"type": "string",
|
|
1181
|
+
"enum": [
|
|
1182
|
+
"error",
|
|
1183
|
+
"warn"
|
|
1184
|
+
],
|
|
1185
|
+
"description": "Severity for the arch rule. \"error\" exits with code 2; \"warn\" reports but exits 0. (arch rules cannot be \"off\" — remove the entry instead.)"
|
|
1186
|
+
}
|
|
1187
|
+
},
|
|
1188
|
+
"required": [
|
|
1189
|
+
"limit",
|
|
1190
|
+
"in"
|
|
1191
|
+
],
|
|
1192
|
+
"additionalProperties": false,
|
|
1193
|
+
"description": "A per-file comment-density ceiling. Caps how much of a file may be explanatory comments — the honest way to push intent into code and names rather than prose (and to keep token cost down), while leaving doc-comments free by default.",
|
|
1194
|
+
"examples": [
|
|
1195
|
+
"arch:\n maxCommentDensity:\n - limit: 5\n in: src/**\n message: \"Encode intent in names, not comments\"",
|
|
1196
|
+
"arch:\n maxCommentDensity:\n - limit: 10\n countDocComments: true\n in: src/**"
|
|
1197
|
+
]
|
|
1198
|
+
}
|
|
1199
|
+
},
|
|
1200
|
+
"maxCommentBlock": {
|
|
1201
|
+
"description": "Per-block comment-height caps. Limit how many comment lines may stack together; doc-comments are exempt by default.",
|
|
1202
|
+
"type": "array",
|
|
1203
|
+
"items": {
|
|
1204
|
+
"type": "object",
|
|
1205
|
+
"properties": {
|
|
1206
|
+
"limit": {
|
|
1207
|
+
"type": "integer",
|
|
1208
|
+
"exclusiveMinimum": 0,
|
|
1209
|
+
"maximum": 9007199254740991,
|
|
1210
|
+
"description": "Maximum number of consecutive comment lines allowed in a single block. A run of more comment lines than this — e.g. a tall comment stacked above a statement — is a violation, reported at the first offending line."
|
|
1211
|
+
},
|
|
1212
|
+
"countDocComments": {
|
|
1213
|
+
"description": "Count doc-comments toward the limit. Doc-comments are `/** … */` JSDoc blocks (TS/JS), `///` (Swift and C#), and `///` or `//!` (Rust); ordinary `//`, `/* */`, and `#` comments are always counted. Defaults to false, so documentation is exempt and only explanatory/inline comments are capped. Has no effect on Python: docstrings are string expressions rather than comments, so they never count toward either limit.",
|
|
1214
|
+
"type": "boolean"
|
|
1215
|
+
},
|
|
1216
|
+
"ignore": {
|
|
1217
|
+
"description": "Comment lines matching these patterns are structural, not prose — marker comments a build or codegen step reads, for example — and count toward neither limit. A literal substring by default; prefix with `re:` for a regex. Ignored lines still count in the density denominator (they are physical lines) and still hold a comment block together, so a marker cannot be used to split an over-tall block.",
|
|
1218
|
+
"anyOf": [
|
|
1219
|
+
{
|
|
1220
|
+
"type": "string"
|
|
1221
|
+
},
|
|
1222
|
+
{
|
|
1223
|
+
"type": "array",
|
|
1224
|
+
"items": {
|
|
1225
|
+
"type": "string"
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
]
|
|
1229
|
+
},
|
|
1230
|
+
"in": {
|
|
1231
|
+
"anyOf": [
|
|
1232
|
+
{
|
|
1233
|
+
"type": "string"
|
|
1234
|
+
},
|
|
1235
|
+
{
|
|
1236
|
+
"type": "array",
|
|
1237
|
+
"items": {
|
|
1238
|
+
"type": "string"
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
],
|
|
1242
|
+
"description": "Layer name(s) or glob(s) the limit applies to. Files outside the scope are not checked."
|
|
1243
|
+
},
|
|
1244
|
+
"message": {
|
|
1245
|
+
"description": "Optional error message. Defaults to a message naming the consecutive-line limit.",
|
|
1246
|
+
"type": "string"
|
|
1247
|
+
},
|
|
1248
|
+
"severity": {
|
|
1249
|
+
"type": "string",
|
|
1250
|
+
"enum": [
|
|
1251
|
+
"error",
|
|
1252
|
+
"warn"
|
|
1253
|
+
],
|
|
1254
|
+
"description": "Severity for the arch rule. \"error\" exits with code 2; \"warn\" reports but exits 0. (arch rules cannot be \"off\" — remove the entry instead.)"
|
|
1255
|
+
}
|
|
1256
|
+
},
|
|
1257
|
+
"required": [
|
|
1258
|
+
"limit",
|
|
1259
|
+
"in"
|
|
1260
|
+
],
|
|
1261
|
+
"additionalProperties": false,
|
|
1262
|
+
"description": "A per-block comment-height cap. Limits how many comment lines may stack together, so comments stay terse and a long explanation becomes a well-named function instead. Doc-comments are exempt by default.",
|
|
1263
|
+
"examples": [
|
|
1264
|
+
"arch:\n maxCommentBlock:\n - limit: 2\n in: src/**\n message: \"Extract a named function instead of a comment block\""
|
|
1265
|
+
]
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
},
|
|
1269
|
+
"additionalProperties": false,
|
|
1270
|
+
"description": "Architecture-as-Code constraints — layers, import boundaries, forbidden patterns, singleton locations, comment budgets. Enforced by the arch engine alongside the rule set."
|
|
1271
|
+
}
|
|
1272
|
+
},
|
|
1273
|
+
"additionalProperties": false,
|
|
1274
|
+
"description": "klint configuration. Lives at klint.yaml (or klint.config.json) next to biome.json and knip.json."
|
|
1275
|
+
}
|