@fast-china/eslint-config 2.1.7 → 2.1.8

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.
Files changed (88) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/CONTRIBUTING.md +2 -2
  3. package/README.md +66 -142
  4. package/README.zh.md +64 -142
  5. package/dist/configs/environment.mjs +2 -0
  6. package/dist/configs/environment.mjs.map +1 -1
  7. package/dist/configs/ignores.mjs +0 -1
  8. package/dist/configs/ignores.mjs.map +1 -1
  9. package/dist/configs/import.mjs +4 -1
  10. package/dist/configs/import.mjs.map +1 -1
  11. package/dist/configs/index.d.mts +2 -2
  12. package/dist/configs/index.mjs +2 -2
  13. package/dist/configs/javascript.mjs +3 -1
  14. package/dist/configs/javascript.mjs.map +1 -1
  15. package/dist/configs/json.mjs +3 -1
  16. package/dist/configs/json.mjs.map +1 -1
  17. package/dist/configs/markdown.d.mts +2 -1
  18. package/dist/configs/markdown.mjs +4 -2
  19. package/dist/configs/markdown.mjs.map +1 -1
  20. package/dist/configs/prettier.mjs +1 -1
  21. package/dist/configs/prettier.mjs.map +1 -1
  22. package/dist/configs/sort-package.d.mts +1 -1
  23. package/dist/configs/sort-package.mjs +1 -1
  24. package/dist/configs/sort-package.mjs.map +1 -1
  25. package/dist/configs/sort-tsconfig.d.mts +2 -2
  26. package/dist/configs/sort-tsconfig.mjs +2 -2
  27. package/dist/configs/sort-tsconfig.mjs.map +1 -1
  28. package/dist/configs/typescript.d.mts +11 -7
  29. package/dist/configs/typescript.mjs +25 -22
  30. package/dist/configs/typescript.mjs.map +1 -1
  31. package/dist/configs/uniapp.mjs +19 -13
  32. package/dist/configs/uniapp.mjs.map +1 -1
  33. package/dist/configs/vue.d.mts +18 -3
  34. package/dist/configs/vue.mjs +59 -9
  35. package/dist/configs/vue.mjs.map +1 -1
  36. package/dist/constants/index.d.mts +4 -0
  37. package/dist/constants/index.mjs +5 -1
  38. package/dist/constants/index.mjs.map +1 -1
  39. package/dist/index.d.mts +37 -58
  40. package/dist/index.mjs +43 -47
  41. package/dist/index.mjs.map +1 -1
  42. package/dist/rules/angular.d.mts +28 -0
  43. package/dist/rules/angular.mjs +28 -0
  44. package/dist/rules/angular.mjs.map +1 -1
  45. package/dist/rules/common.d.mts +16 -6
  46. package/dist/rules/common.mjs +16 -13
  47. package/dist/rules/common.mjs.map +1 -1
  48. package/dist/rules/import.d.mts +9 -0
  49. package/dist/rules/import.mjs +24 -0
  50. package/dist/rules/import.mjs.map +1 -1
  51. package/dist/rules/index.d.mts +2 -2
  52. package/dist/rules/index.mjs +2 -2
  53. package/dist/rules/javascript.d.mts +18 -0
  54. package/dist/rules/javascript.mjs +18 -0
  55. package/dist/rules/javascript.mjs.map +1 -1
  56. package/dist/rules/lodash.d.mts +2 -0
  57. package/dist/rules/lodash.mjs +6 -2
  58. package/dist/rules/lodash.mjs.map +1 -1
  59. package/dist/rules/react.d.mts +13 -0
  60. package/dist/rules/react.mjs +13 -0
  61. package/dist/rules/react.mjs.map +1 -1
  62. package/dist/rules/regexp.d.mts +25 -0
  63. package/dist/rules/regexp.mjs +25 -0
  64. package/dist/rules/regexp.mjs.map +1 -1
  65. package/dist/rules/sort-package.d.mts +3 -1
  66. package/dist/rules/sort-package.mjs +3 -1
  67. package/dist/rules/sort-package.mjs.map +1 -1
  68. package/dist/rules/sort-tsconfig.d.mts +3 -1
  69. package/dist/rules/sort-tsconfig.mjs +3 -1
  70. package/dist/rules/sort-tsconfig.mjs.map +1 -1
  71. package/dist/rules/typescript.d.mts +81 -13
  72. package/dist/rules/typescript.mjs +83 -15
  73. package/dist/rules/typescript.mjs.map +1 -1
  74. package/dist/rules/vue.d.mts +65 -10
  75. package/dist/rules/vue.mjs +41 -14
  76. package/dist/rules/vue.mjs.map +1 -1
  77. package/docs/engineering-audit.zh.md +45 -49
  78. package/docs/rules/angular.zh.md +721 -0
  79. package/docs/rules/core.zh.md +3031 -0
  80. package/docs/rules/index.zh.md +38 -0
  81. package/docs/rules/json.zh.md +784 -0
  82. package/docs/rules/markdown.zh.md +449 -0
  83. package/docs/rules/react.zh.md +2091 -0
  84. package/docs/rules/typescript.zh.md +2051 -0
  85. package/docs/rules/vue.zh.md +3016 -0
  86. package/docs/rules-risk.md +85 -91
  87. package/docs/rules-risk.zh.md +76 -82
  88. package/package.json +4 -2
@@ -0,0 +1,784 @@
1
+ <!-- 此文件由 scripts/rules-docs.ts 生成,请勿手工编辑。 -->
2
+
3
+ # JSON、JSONC 与 JSON5
4
+
5
+ 本页记录当前依赖版本和仓库配置最终产生的 32 条规则。每条规则均列出实际严重级别、生效范围、上游说明、常见报告以及错误/正确示例。
6
+
7
+ ## 仓库显式规则(3 条)
8
+
9
+ ### `jsonc/no-comments`
10
+
11
+ UniApp 的 `pages.json` 和 `manifest.json` 使用允许注释的 JSONC 方言。
12
+
13
+ - 生效级别与范围:error: JSON、package.json
14
+ - 关闭范围:tsconfig.json
15
+ - 自动修复:不支持或上游未声明
16
+ - 规则来源:[官方文档](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-comments.html)
17
+ - 常见报告:`Unexpected comment.`
18
+ - 示例类型:仓库显式规则的直接代码示例
19
+
20
+ 错误示例:
21
+
22
+ <!-- prettier-ignore -->
23
+ ````jsonc
24
+ { // name
25
+ "name": "Fast"
26
+ }
27
+ ````
28
+
29
+ 正确示例:
30
+
31
+ <!-- prettier-ignore -->
32
+ ````jsonc
33
+ { "name": "Fast" }
34
+ ````
35
+
36
+ ### `jsonc/sort-array-values`
37
+
38
+ npm 的 `files` 清单按字母排序;数组顺序不改打包集合,但首次 diff 较大。
39
+
40
+ - 生效级别与范围:error: package.json
41
+ - 自动修复:支持;执行前仍应检查语义和差异
42
+ - 规则来源:[官方文档](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/sort-array-values.html)
43
+ - 常见报告:`Expected array values to be in {{orderText}} order. '{{thisValue}}' should be before '{{targetValue}}'.`;`Expected array values to be in {{orderText}} order. '{{thisValue}}' should be after '{{targetValue}}'.`
44
+ - 示例类型:仓库显式规则的直接代码示例
45
+
46
+ 错误示例:
47
+
48
+ <!-- prettier-ignore -->
49
+ ````json
50
+ { "files": ["dist/z.js", "dist/a.js"] }
51
+ ````
52
+
53
+ 正确示例:
54
+
55
+ <!-- prettier-ignore -->
56
+ ````json
57
+ { "files": ["dist/a.js", "dist/z.js"] }
58
+ ````
59
+
60
+ ### `jsonc/sort-keys`
61
+
62
+ 只调整顶层和 `compilerOptions` 的键顺序,不改写任何选项值或数组。
63
+
64
+ - 生效级别与范围:error: package.json、tsconfig.json
65
+ - 自动修复:支持;执行前仍应检查语义和差异
66
+ - 规则来源:[官方文档](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/sort-keys.html)
67
+ - 常见报告:`Expected object keys to be in {{orderText}} order. '{{thisName}}' should be before '{{targetName}}'.`;`Expected object keys to be in {{orderText}} order. '{{thisName}}' should be after '{{targetName}}'.`
68
+ - 示例类型:仓库显式规则的直接代码示例
69
+
70
+ 错误示例:
71
+
72
+ <!-- prettier-ignore -->
73
+ ````json
74
+ { "version": "1.0.0", "name": "demo" }
75
+ ````
76
+
77
+ 正确示例:
78
+
79
+ <!-- prettier-ignore -->
80
+ ````json
81
+ { "name": "demo", "version": "1.0.0" }
82
+ ````
83
+
84
+ ## 第三方预置规则(29 条)
85
+
86
+ ### `jsonc/comma-dangle`
87
+
88
+ 检查该规则对应的代码约束。上游说明:require or disallow trailing commas
89
+
90
+ - 生效级别与范围:error: JSON、package.json、tsconfig.json
91
+ - 自动修复:支持;执行前仍应检查语义和差异
92
+ - 规则来源:[官方文档](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/comma-dangle.html)
93
+ - 常见报告:`Unexpected trailing comma.`;`Missing trailing comma.`
94
+ - 示例类型:第三方预置规则的直接代码示例
95
+
96
+ 错误示例:
97
+
98
+ <!-- prettier-ignore -->
99
+ ````jsonc
100
+ { "name": "Fast", }
101
+ ````
102
+
103
+ 正确示例:
104
+
105
+ <!-- prettier-ignore -->
106
+ ````jsonc
107
+ { "name": "Fast" }
108
+ ````
109
+
110
+ ### `jsonc/no-bigint-literals`
111
+
112
+ 禁止出现该规则定义的不安全、无效或易误解结构。上游说明:disallow BigInt literals
113
+
114
+ - 生效级别与范围:error: JSON、JSONC、JSON5、package.json、tsconfig.json
115
+ - 自动修复:不支持或上游未声明
116
+ - 规则来源:[官方文档](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-bigint-literals.html)
117
+ - 常见报告:`BigInt literals are not allowed.`
118
+ - 示例类型:第三方预置规则的直接代码示例
119
+
120
+ 错误示例:
121
+
122
+ <!-- prettier-ignore -->
123
+ ````jsonc
124
+ { "id": 1n }
125
+ ````
126
+
127
+ 正确示例:
128
+
129
+ <!-- prettier-ignore -->
130
+ ````jsonc
131
+ { "id": "1" }
132
+ ````
133
+
134
+ ### `jsonc/no-binary-expression`
135
+
136
+ 禁止出现该规则定义的不安全、无效或易误解结构。上游说明:disallow binary expression
137
+
138
+ - 生效级别与范围:error: JSON、JSONC、JSON5、package.json、tsconfig.json
139
+ - 自动修复:支持;执行前仍应检查语义和差异
140
+ - 规则来源:[官方文档](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-binary-expression.html)
141
+ - 常见报告:`The binary expressions are not allowed.`
142
+ - 示例类型:第三方预置规则的直接代码示例
143
+
144
+ 错误示例:
145
+
146
+ <!-- prettier-ignore -->
147
+ ````jsonc
148
+ { "timeout": 1000 + 500 }
149
+ ````
150
+
151
+ 正确示例:
152
+
153
+ <!-- prettier-ignore -->
154
+ ````jsonc
155
+ { "timeout": 1500 }
156
+ ````
157
+
158
+ ### `jsonc/no-binary-numeric-literals`
159
+
160
+ 禁止出现该规则定义的不安全、无效或易误解结构。上游说明:disallow binary numeric literals
161
+
162
+ - 生效级别与范围:error: JSON、JSONC、JSON5、package.json、tsconfig.json
163
+ - 自动修复:支持;执行前仍应检查语义和差异
164
+ - 规则来源:[官方文档](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-binary-numeric-literals.html)
165
+ - 常见报告:`Binary numeric literals should not be used.`
166
+ - 示例类型:第三方预置规则的直接代码示例
167
+
168
+ 错误示例:
169
+
170
+ <!-- prettier-ignore -->
171
+ ````jsonc
172
+ { "mask": 0b1010 }
173
+ ````
174
+
175
+ 正确示例:
176
+
177
+ <!-- prettier-ignore -->
178
+ ````jsonc
179
+ { "mask": 10 }
180
+ ````
181
+
182
+ ### `jsonc/no-dupe-keys`
183
+
184
+ 禁止出现该规则定义的不安全、无效或易误解结构。上游说明:disallow duplicate keys in object literals
185
+
186
+ - 生效级别与范围:error: JSON、JSONC、JSON5、package.json、tsconfig.json
187
+ - 自动修复:不支持或上游未声明
188
+ - 规则来源:[官方文档](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-dupe-keys.html)
189
+ - 常见报告:`Duplicate key '{{name}}'.`
190
+ - 示例类型:第三方预置规则的直接代码示例
191
+
192
+ 错误示例:
193
+
194
+ <!-- prettier-ignore -->
195
+ ````jsonc
196
+ { "name": "Fast", "name": "Admin" }
197
+ ````
198
+
199
+ 正确示例:
200
+
201
+ <!-- prettier-ignore -->
202
+ ````jsonc
203
+ { "name": "Fast", "title": "Admin" }
204
+ ````
205
+
206
+ ### `jsonc/no-escape-sequence-in-identifier`
207
+
208
+ 禁止出现该规则定义的不安全、无效或易误解结构。上游说明:disallow escape sequences in identifiers.
209
+
210
+ - 生效级别与范围:error: JSON、JSONC、JSON5、package.json、tsconfig.json
211
+ - 自动修复:支持;执行前仍应检查语义和差异
212
+ - 规则来源:[官方文档](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-escape-sequence-in-identifier.html)
213
+ - 常见报告:`Escape sequence in identifiers should not be used.`
214
+ - 示例类型:第三方预置规则的直接代码示例
215
+
216
+ 错误示例:
217
+
218
+ <!-- prettier-ignore -->
219
+ ````jsonc
220
+ { \u0061: "Fast" }
221
+ ````
222
+
223
+ 正确示例:
224
+
225
+ <!-- prettier-ignore -->
226
+ ````jsonc
227
+ { a: "Fast" }
228
+ ````
229
+
230
+ ### `jsonc/no-floating-decimal`
231
+
232
+ 禁止出现该规则定义的不安全、无效或易误解结构。上游说明:disallow leading or trailing decimal points in numeric literals
233
+
234
+ - 生效级别与范围:error: JSON、JSONC、package.json、tsconfig.json
235
+ - 自动修复:支持;执行前仍应检查语义和差异
236
+ - 规则来源:[官方文档](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-floating-decimal.html)
237
+ - 常见报告:`A leading decimal point can be confused with a dot.`;`A trailing decimal point can be confused with a dot.`
238
+ - 示例类型:第三方预置规则的直接代码示例
239
+
240
+ 错误示例:
241
+
242
+ <!-- prettier-ignore -->
243
+ ````jsonc
244
+ { "ratio": .5 }
245
+ ````
246
+
247
+ 正确示例:
248
+
249
+ <!-- prettier-ignore -->
250
+ ````jsonc
251
+ { "ratio": 0.5 }
252
+ ````
253
+
254
+ ### `jsonc/no-hexadecimal-numeric-literals`
255
+
256
+ 禁止出现该规则定义的不安全、无效或易误解结构。上游说明:disallow hexadecimal numeric literals
257
+
258
+ - 生效级别与范围:error: JSON、JSONC、package.json、tsconfig.json
259
+ - 自动修复:支持;执行前仍应检查语义和差异
260
+ - 规则来源:[官方文档](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-hexadecimal-numeric-literals.html)
261
+ - 常见报告:`Hexadecimal numeric literals should not be used.`
262
+ - 示例类型:第三方预置规则的直接代码示例
263
+
264
+ 错误示例:
265
+
266
+ <!-- prettier-ignore -->
267
+ ````jsonc
268
+ { "color": 0xff }
269
+ ````
270
+
271
+ 正确示例:
272
+
273
+ <!-- prettier-ignore -->
274
+ ````jsonc
275
+ { "color": 255 }
276
+ ````
277
+
278
+ ### `jsonc/no-infinity`
279
+
280
+ 禁止出现该规则定义的不安全、无效或易误解结构。上游说明:disallow Infinity
281
+
282
+ - 生效级别与范围:error: JSON、JSONC、package.json、tsconfig.json
283
+ - 自动修复:不支持或上游未声明
284
+ - 规则来源:[官方文档](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-infinity.html)
285
+ - 常见报告:`Infinity should not be used.`
286
+ - 示例类型:第三方预置规则的直接代码示例
287
+
288
+ 错误示例:
289
+
290
+ <!-- prettier-ignore -->
291
+ ````jsonc
292
+ { "limit": Infinity }
293
+ ````
294
+
295
+ 正确示例:
296
+
297
+ <!-- prettier-ignore -->
298
+ ````jsonc
299
+ { "limit": null }
300
+ ````
301
+
302
+ ### `jsonc/no-irregular-whitespace`
303
+
304
+ 禁止出现该规则定义的不安全、无效或易误解结构。上游说明:disallow irregular whitespace
305
+
306
+ - 生效级别与范围:error: JSON、JSONC、JSON5、package.json、tsconfig.json
307
+ - 自动修复:不支持或上游未声明
308
+ - 规则来源:[官方文档](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-irregular-whitespace.html)
309
+ - 常见报告:`Irregular whitespace not allowed.`
310
+ - 示例类型:第三方预置规则的直接代码示例
311
+
312
+ 错误示例:
313
+
314
+ <!-- prettier-ignore -->
315
+ ````jsonc
316
+ {
317
+  "name": "Fast"
318
+ }
319
+ ````
320
+
321
+ 正确示例:
322
+
323
+ <!-- prettier-ignore -->
324
+ ````jsonc
325
+ {
326
+ "name": "Fast"
327
+ }
328
+ ````
329
+
330
+ ### `jsonc/no-multi-str`
331
+
332
+ 禁止出现该规则定义的不安全、无效或易误解结构。上游说明:disallow multiline strings
333
+
334
+ - 生效级别与范围:error: JSON、JSONC、package.json、tsconfig.json
335
+ - 自动修复:不支持或上游未声明
336
+ - 规则来源:[官方文档](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-multi-str.html)
337
+ - 常见报告:`Multiline support is limited to JSON5 only.`
338
+ - 示例类型:第三方预置规则的直接代码示例
339
+
340
+ 错误示例:
341
+
342
+ <!-- prettier-ignore -->
343
+ ````jsonc
344
+ { "text": "first\
345
+ second" }
346
+ ````
347
+
348
+ 正确示例:
349
+
350
+ <!-- prettier-ignore -->
351
+ ````jsonc
352
+ { "text": "first\nsecond" }
353
+ ````
354
+
355
+ ### `jsonc/no-nan`
356
+
357
+ 禁止出现该规则定义的不安全、无效或易误解结构。上游说明:disallow NaN
358
+
359
+ - 生效级别与范围:error: JSON、JSONC、package.json、tsconfig.json
360
+ - 自动修复:不支持或上游未声明
361
+ - 规则来源:[官方文档](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-nan.html)
362
+ - 常见报告:`NaN should not be used.`
363
+ - 示例类型:第三方预置规则的直接代码示例
364
+
365
+ 错误示例:
366
+
367
+ <!-- prettier-ignore -->
368
+ ````jsonc
369
+ { "value": NaN }
370
+ ````
371
+
372
+ 正确示例:
373
+
374
+ <!-- prettier-ignore -->
375
+ ````jsonc
376
+ { "value": null }
377
+ ````
378
+
379
+ ### `jsonc/no-number-props`
380
+
381
+ 禁止出现该规则定义的不安全、无效或易误解结构。上游说明:disallow number property keys
382
+
383
+ - 生效级别与范围:error: JSON、JSONC、JSON5、package.json、tsconfig.json
384
+ - 自动修复:支持;执行前仍应检查语义和差异
385
+ - 规则来源:[官方文档](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-number-props.html)
386
+ - 常见报告:`The number property keys are not allowed.`
387
+ - 示例类型:第三方预置规则的直接代码示例
388
+
389
+ 错误示例:
390
+
391
+ <!-- prettier-ignore -->
392
+ ````jsonc
393
+ { 1: "one" }
394
+ ````
395
+
396
+ 正确示例:
397
+
398
+ <!-- prettier-ignore -->
399
+ ````jsonc
400
+ { "1": "one" }
401
+ ````
402
+
403
+ ### `jsonc/no-numeric-separators`
404
+
405
+ 禁止出现该规则定义的不安全、无效或易误解结构。上游说明:disallow numeric separators
406
+
407
+ - 生效级别与范围:error: JSON、JSONC、JSON5、package.json、tsconfig.json
408
+ - 自动修复:支持;执行前仍应检查语义和差异
409
+ - 规则来源:[官方文档](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-numeric-separators.html)
410
+ - 常见报告:`Numeric separators are not allowed.`
411
+ - 示例类型:第三方预置规则的直接代码示例
412
+
413
+ 错误示例:
414
+
415
+ <!-- prettier-ignore -->
416
+ ````jsonc
417
+ { "size": 1_000 }
418
+ ````
419
+
420
+ 正确示例:
421
+
422
+ <!-- prettier-ignore -->
423
+ ````jsonc
424
+ { "size": 1000 }
425
+ ````
426
+
427
+ ### `jsonc/no-octal`
428
+
429
+ 禁止出现该规则定义的不安全、无效或易误解结构。上游说明:disallow legacy octal literals
430
+
431
+ - 生效级别与范围:error: JSON、JSONC、JSON5、package.json、tsconfig.json
432
+ - 自动修复:不支持或上游未声明
433
+ - 规则来源:[官方文档](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-octal.html)
434
+ - 常见报告:`Octal literals should not be used.`
435
+ - 示例类型:第三方预置规则的直接代码示例
436
+
437
+ 错误示例:
438
+
439
+ <!-- prettier-ignore -->
440
+ ````jsonc
441
+ { "mode": 071 }
442
+ ````
443
+
444
+ 正确示例:
445
+
446
+ <!-- prettier-ignore -->
447
+ ````jsonc
448
+ { "mode": 57 }
449
+ ````
450
+
451
+ ### `jsonc/no-octal-numeric-literals`
452
+
453
+ 禁止出现该规则定义的不安全、无效或易误解结构。上游说明:disallow octal numeric literals
454
+
455
+ - 生效级别与范围:error: JSON、JSONC、JSON5、package.json、tsconfig.json
456
+ - 自动修复:支持;执行前仍应检查语义和差异
457
+ - 规则来源:[官方文档](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-octal-numeric-literals.html)
458
+ - 常见报告:`Octal numeric literals should not be used.`
459
+ - 示例类型:第三方预置规则的直接代码示例
460
+
461
+ 错误示例:
462
+
463
+ <!-- prettier-ignore -->
464
+ ````jsonc
465
+ { "mode": 0o71 }
466
+ ````
467
+
468
+ 正确示例:
469
+
470
+ <!-- prettier-ignore -->
471
+ ````jsonc
472
+ { "mode": 57 }
473
+ ````
474
+
475
+ ### `jsonc/no-parenthesized`
476
+
477
+ 禁止出现该规则定义的不安全、无效或易误解结构。上游说明:disallow parentheses around the expression
478
+
479
+ - 生效级别与范围:error: JSON、JSONC、JSON5、package.json、tsconfig.json
480
+ - 自动修复:支持;执行前仍应检查语义和差异
481
+ - 规则来源:[官方文档](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-parenthesized.html)
482
+ - 常见报告:`Parentheses around expression should not be used.`
483
+ - 示例类型:第三方预置规则的直接代码示例
484
+
485
+ 错误示例:
486
+
487
+ <!-- prettier-ignore -->
488
+ ````jsonc
489
+ { "timeout": (1000) }
490
+ ````
491
+
492
+ 正确示例:
493
+
494
+ <!-- prettier-ignore -->
495
+ ````jsonc
496
+ { "timeout": 1000 }
497
+ ````
498
+
499
+ ### `jsonc/no-plus-sign`
500
+
501
+ 禁止出现该规则定义的不安全、无效或易误解结构。上游说明:disallow plus sign
502
+
503
+ - 生效级别与范围:error: JSON、JSONC、package.json、tsconfig.json
504
+ - 自动修复:支持;执行前仍应检查语义和差异
505
+ - 规则来源:[官方文档](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-plus-sign.html)
506
+ - 常见报告:`Plus sign should not be used.`
507
+ - 示例类型:第三方预置规则的直接代码示例
508
+
509
+ 错误示例:
510
+
511
+ <!-- prettier-ignore -->
512
+ ````jsonc
513
+ { "offset": +1 }
514
+ ````
515
+
516
+ 正确示例:
517
+
518
+ <!-- prettier-ignore -->
519
+ ````jsonc
520
+ { "offset": 1 }
521
+ ````
522
+
523
+ ### `jsonc/no-regexp-literals`
524
+
525
+ 禁止出现该规则定义的不安全、无效或易误解结构。上游说明:disallow RegExp literals
526
+
527
+ - 生效级别与范围:error: JSON、JSONC、JSON5、package.json、tsconfig.json
528
+ - 自动修复:不支持或上游未声明
529
+ - 规则来源:[官方文档](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-regexp-literals.html)
530
+ - 常见报告:`RegExp literals are not allowed.`
531
+ - 示例类型:第三方预置规则的直接代码示例
532
+
533
+ 错误示例:
534
+
535
+ <!-- prettier-ignore -->
536
+ ````jsonc
537
+ { "pattern": /fast/i }
538
+ ````
539
+
540
+ 正确示例:
541
+
542
+ <!-- prettier-ignore -->
543
+ ````jsonc
544
+ { "pattern": "fast" }
545
+ ````
546
+
547
+ ### `jsonc/no-sparse-arrays`
548
+
549
+ 禁止出现该规则定义的不安全、无效或易误解结构。上游说明:disallow sparse arrays
550
+
551
+ - 生效级别与范围:error: JSON、JSONC、JSON5、package.json、tsconfig.json
552
+ - 自动修复:不支持或上游未声明
553
+ - 规则来源:[官方文档](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-sparse-arrays.html)
554
+ - 常见报告:`Unexpected comma in middle of array.`
555
+ - 示例类型:第三方预置规则的直接代码示例
556
+
557
+ 错误示例:
558
+
559
+ <!-- prettier-ignore -->
560
+ ````jsonc
561
+ { "items": [1, , 3] }
562
+ ````
563
+
564
+ 正确示例:
565
+
566
+ <!-- prettier-ignore -->
567
+ ````jsonc
568
+ { "items": [1, null, 3] }
569
+ ````
570
+
571
+ ### `jsonc/no-template-literals`
572
+
573
+ 禁止出现该规则定义的不安全、无效或易误解结构。上游说明:disallow template literals
574
+
575
+ - 生效级别与范围:error: JSON、JSONC、JSON5、package.json、tsconfig.json
576
+ - 自动修复:支持;执行前仍应检查语义和差异
577
+ - 规则来源:[官方文档](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-template-literals.html)
578
+ - 常见报告:`The template literals are not allowed.`
579
+ - 示例类型:第三方预置规则的直接代码示例
580
+
581
+ 错误示例:
582
+
583
+ <!-- prettier-ignore -->
584
+ ````jsonc
585
+ { "name": `Fast` }
586
+ ````
587
+
588
+ 正确示例:
589
+
590
+ <!-- prettier-ignore -->
591
+ ````jsonc
592
+ { "name": "Fast" }
593
+ ````
594
+
595
+ ### `jsonc/no-undefined-value`
596
+
597
+ 禁止出现该规则定义的不安全、无效或易误解结构。上游说明:disallow `undefined`
598
+
599
+ - 生效级别与范围:error: JSON、JSONC、JSON5、package.json、tsconfig.json
600
+ - 自动修复:不支持或上游未声明
601
+ - 规则来源:[官方文档](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-undefined-value.html)
602
+ - 常见报告:`'undefined' is not allowed.`
603
+ - 示例类型:第三方预置规则的直接代码示例
604
+
605
+ 错误示例:
606
+
607
+ <!-- prettier-ignore -->
608
+ ````jsonc
609
+ { "value": undefined }
610
+ ````
611
+
612
+ 正确示例:
613
+
614
+ <!-- prettier-ignore -->
615
+ ````jsonc
616
+ { "value": null }
617
+ ````
618
+
619
+ ### `jsonc/no-unicode-codepoint-escapes`
620
+
621
+ 禁止出现该规则定义的不安全、无效或易误解结构。上游说明:disallow Unicode code point escape sequences.
622
+
623
+ - 生效级别与范围:error: JSON、JSONC、JSON5、package.json、tsconfig.json
624
+ - 自动修复:支持;执行前仍应检查语义和差异
625
+ - 规则来源:[官方文档](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-unicode-codepoint-escapes.html)
626
+ - 常见报告:`Unicode code point escape sequence should not be used.`
627
+ - 示例类型:第三方预置规则的直接代码示例
628
+
629
+ 错误示例:
630
+
631
+ <!-- prettier-ignore -->
632
+ ````jsonc
633
+ { "emoji": "\u{1F600}" }
634
+ ````
635
+
636
+ 正确示例:
637
+
638
+ <!-- prettier-ignore -->
639
+ ````jsonc
640
+ { "emoji": "😀" }
641
+ ````
642
+
643
+ ### `jsonc/no-useless-escape`
644
+
645
+ 禁止出现该规则定义的不安全、无效或易误解结构。上游说明:disallow unnecessary escape usage
646
+
647
+ - 生效级别与范围:error: JSON、JSONC、JSON5、package.json、tsconfig.json
648
+ - 自动修复:不支持或上游未声明
649
+ - 规则来源:[官方文档](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-useless-escape.html)
650
+ - 常见报告:`Unnecessary escape character: \{{character}}.`;`Remove the '\'. This maintains the current functionality.`;`Remove the '\' if it was inserted by mistake.`
651
+ - 示例类型:第三方预置规则的直接代码示例
652
+
653
+ 错误示例:
654
+
655
+ <!-- prettier-ignore -->
656
+ ````jsonc
657
+ { "name": "Fast\!" }
658
+ ````
659
+
660
+ 正确示例:
661
+
662
+ <!-- prettier-ignore -->
663
+ ````jsonc
664
+ { "name": "Fast!" }
665
+ ````
666
+
667
+ ### `jsonc/quote-props`
668
+
669
+ 检查该规则对应的代码约束。上游说明:require quotes around object literal property names
670
+
671
+ - 生效级别与范围:error: JSON、JSONC、package.json、tsconfig.json
672
+ - 自动修复:支持;执行前仍应检查语义和差异
673
+ - 规则来源:[官方文档](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/quote-props.html)
674
+ - 常见报告:`Properties should be quoted as '{{property}}' is a reserved word.`;`Inconsistently quoted property '{{key}}' found.`;`Unnecessarily quoted property '{{property}}' found.`
675
+ - 示例类型:第三方预置规则的直接代码示例
676
+
677
+ 错误示例:
678
+
679
+ <!-- prettier-ignore -->
680
+ ````jsonc
681
+ { name: "Fast" }
682
+ ````
683
+
684
+ 正确示例:
685
+
686
+ <!-- prettier-ignore -->
687
+ ````jsonc
688
+ { "name": "Fast" }
689
+ ````
690
+
691
+ ### `jsonc/quotes`
692
+
693
+ 检查该规则对应的代码约束。上游说明:enforce use of double or single quotes
694
+
695
+ - 生效级别与范围:error: JSON、JSONC、package.json、tsconfig.json
696
+ - 自动修复:支持;执行前仍应检查语义和差异
697
+ - 规则来源:[官方文档](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/quotes.html)
698
+ - 常见报告:`Strings must use {{description}}.`
699
+ - 示例类型:第三方预置规则的直接代码示例
700
+
701
+ 错误示例:
702
+
703
+ <!-- prettier-ignore -->
704
+ ````jsonc
705
+ { 'name': 'Fast' }
706
+ ````
707
+
708
+ 正确示例:
709
+
710
+ <!-- prettier-ignore -->
711
+ ````jsonc
712
+ { "name": "Fast" }
713
+ ````
714
+
715
+ ### `jsonc/space-unary-ops`
716
+
717
+ 检查该规则对应的代码约束。上游说明:disallow spaces after unary operators
718
+
719
+ - 生效级别与范围:error: JSON、JSONC、JSON5、package.json、tsconfig.json
720
+ - 自动修复:支持;执行前仍应检查语义和差异
721
+ - 规则来源:[官方文档](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/space-unary-ops.html)
722
+ - 常见报告:`Unexpected space before unary operator '{{operator}}'.`;`Unexpected space after unary operator '{{operator}}'.`;`Unary operator '{{operator}}' must be followed by whitespace.`
723
+ - 示例类型:第三方预置规则的直接代码示例
724
+
725
+ 错误示例:
726
+
727
+ <!-- prettier-ignore -->
728
+ ````jsonc
729
+ { "offset": - 1 }
730
+ ````
731
+
732
+ 正确示例:
733
+
734
+ <!-- prettier-ignore -->
735
+ ````jsonc
736
+ { "offset": -1 }
737
+ ````
738
+
739
+ ### `jsonc/valid-json-number`
740
+
741
+ 校验对应语法、属性或参数是否合法。上游说明:disallow invalid number for JSON
742
+
743
+ - 生效级别与范围:error: JSON、JSONC、package.json、tsconfig.json
744
+ - 自动修复:支持;执行前仍应检查语义和差异
745
+ - 规则来源:[官方文档](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/valid-json-number.html)
746
+ - 常见报告:`Invalid number for JSON.`;`Spaces after minus sign are not allowed in JSON.`;`Plus signs are not allowed in JSON.`
747
+ - 示例类型:第三方预置规则的直接代码示例
748
+
749
+ 错误示例:
750
+
751
+ <!-- prettier-ignore -->
752
+ ````jsonc
753
+ { "value": 01 }
754
+ ````
755
+
756
+ 正确示例:
757
+
758
+ <!-- prettier-ignore -->
759
+ ````jsonc
760
+ { "value": 1 }
761
+ ````
762
+
763
+ ### `jsonc/vue-custom-block/no-parsing-error`
764
+
765
+ 禁止出现该规则定义的不安全、无效或易误解结构。上游说明:disallow parsing errors in Vue custom blocks
766
+
767
+ - 生效级别与范围:error: JSON、JSONC、JSON5、package.json、tsconfig.json
768
+ - 自动修复:不支持或上游未声明
769
+ - 规则来源:[官方文档](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/vue-custom-block/no-parsing-error.html)
770
+ - 示例类型:第三方预置规则的直接代码示例
771
+
772
+ 错误示例:
773
+
774
+ <!-- prettier-ignore -->
775
+ ````vue
776
+ <i18n>{ "hello": }</i18n>
777
+ ````
778
+
779
+ 正确示例:
780
+
781
+ <!-- prettier-ignore -->
782
+ ````vue
783
+ <i18n>{ "hello": "Hello" }</i18n>
784
+ ````