@markuplint/types 3.8.0 → 4.0.0-alpha.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.
Files changed (93) hide show
  1. package/lib/check-multi-types.d.ts +2 -2
  2. package/lib/check-multi-types.js +9 -14
  3. package/lib/check.d.ts +1 -1
  4. package/lib/check.js +20 -30
  5. package/lib/css-syntax.d.ts +1 -1
  6. package/lib/css-syntax.js +18 -23
  7. package/lib/debug.js +2 -6
  8. package/lib/defs.d.ts +1 -1
  9. package/lib/defs.js +82 -85
  10. package/lib/enum.d.ts +2 -2
  11. package/lib/enum.js +6 -11
  12. package/lib/get-candidate.js +3 -8
  13. package/lib/index.d.ts +3 -3
  14. package/lib/index.js +3 -6
  15. package/lib/keyword-type.d.ts +2 -2
  16. package/lib/keyword-type.js +17 -22
  17. package/lib/list.d.ts +2 -2
  18. package/lib/list.js +9 -14
  19. package/lib/match-result.d.ts +1 -1
  20. package/lib/match-result.js +6 -13
  21. package/lib/number.d.ts +2 -2
  22. package/lib/number.js +11 -15
  23. package/lib/primitive/index.d.ts +7 -7
  24. package/lib/primitive/index.js +7 -17
  25. package/lib/primitive/is-float.js +1 -5
  26. package/lib/primitive/is-int.js +1 -5
  27. package/lib/primitive/is-non-zero-uint.js +1 -5
  28. package/lib/primitive/is-quantity.js +9 -13
  29. package/lib/primitive/is-uint.js +1 -5
  30. package/lib/primitive/range.js +1 -5
  31. package/lib/primitive/split-unit.js +3 -7
  32. package/lib/rfc/is-bcp-47.d.ts +1 -1
  33. package/lib/rfc/is-bcp-47.js +3 -7
  34. package/lib/token/index.d.ts +2 -2
  35. package/lib/token/index.js +2 -7
  36. package/lib/token/token-collection.d.ts +4 -5
  37. package/lib/token/token-collection.js +35 -43
  38. package/lib/token/token.d.ts +2 -2
  39. package/lib/token/token.js +6 -13
  40. package/lib/token/types.js +1 -2
  41. package/lib/types.d.ts +2 -2
  42. package/lib/types.js +1 -2
  43. package/lib/types.schema.js +1 -2
  44. package/lib/w3c/check-serialized-permissions-policy.d.ts +1 -1
  45. package/lib/w3c/check-serialized-permissions-policy.js +16 -20
  46. package/lib/whatwg/check-autocomplete.d.ts +1 -1
  47. package/lib/whatwg/check-autocomplete.js +24 -28
  48. package/lib/whatwg/check-datetime/date-string.d.ts +1 -1
  49. package/lib/whatwg/check-datetime/date-string.js +9 -13
  50. package/lib/whatwg/check-datetime/datetime-tokens.d.ts +1 -1
  51. package/lib/whatwg/check-datetime/datetime-tokens.js +40 -46
  52. package/lib/whatwg/check-datetime/duration-string.d.ts +1 -1
  53. package/lib/whatwg/check-datetime/duration-string.js +38 -44
  54. package/lib/whatwg/check-datetime/global-date-and-time-string.d.ts +1 -1
  55. package/lib/whatwg/check-datetime/global-date-and-time-string.js +17 -21
  56. package/lib/whatwg/check-datetime/index.d.ts +1 -1
  57. package/lib/whatwg/check-datetime/index.js +25 -29
  58. package/lib/whatwg/check-datetime/local-date-and-time-string.d.ts +1 -1
  59. package/lib/whatwg/check-datetime/local-date-and-time-string.js +20 -25
  60. package/lib/whatwg/check-datetime/month-string.d.ts +1 -1
  61. package/lib/whatwg/check-datetime/month-string.js +9 -13
  62. package/lib/whatwg/check-datetime/time-string.d.ts +1 -1
  63. package/lib/whatwg/check-datetime/time-string.js +9 -13
  64. package/lib/whatwg/check-datetime/time-zone-offset-string.d.ts +3 -3
  65. package/lib/whatwg/check-datetime/time-zone-offset-string.js +16 -22
  66. package/lib/whatwg/check-datetime/week-string.d.ts +1 -1
  67. package/lib/whatwg/check-datetime/week-string.js +9 -13
  68. package/lib/whatwg/check-datetime/year-string.d.ts +1 -1
  69. package/lib/whatwg/check-datetime/year-string.js +9 -13
  70. package/lib/whatwg/check-datetime/yearless-date-string.d.ts +1 -1
  71. package/lib/whatwg/check-datetime/yearless-date-string.js +9 -13
  72. package/lib/whatwg/check-mime-type.d.ts +1 -1
  73. package/lib/whatwg/check-mime-type.js +11 -17
  74. package/lib/whatwg/is-abs-url.d.ts +1 -1
  75. package/lib/whatwg/is-abs-url.js +1 -5
  76. package/lib/whatwg/is-browser-context-name.d.ts +1 -1
  77. package/lib/whatwg/is-browser-context-name.js +1 -5
  78. package/lib/whatwg/is-custom-element-name.d.ts +1 -1
  79. package/lib/whatwg/is-custom-element-name.js +1 -5
  80. package/lib/whatwg/is-itemprop-name.d.ts +1 -1
  81. package/lib/whatwg/is-itemprop-name.js +1 -5
  82. package/package.json +13 -8
  83. package/test/check.spec.js +0 -89
  84. package/test/css-syntax.spec.js +0 -170
  85. package/test/list.spec.js +0 -133
  86. package/test/primitive/index.spec.js +0 -65
  87. package/test/rfc/is-bcp-47.spec.js +0 -23
  88. package/test/token/token-collection.spec.js +0 -146
  89. package/test/w3c/check-serialized-permissions-policy.spec.js +0 -36
  90. package/test/whatwg/check-autocomplete.spec.js +0 -387
  91. package/test/whatwg/check-datetime/index.spec.js +0 -336
  92. package/test/whatwg/check-mime-type.spec.js +0 -59
  93. package/test/whatwg/is-abs-url.spec.js +0 -8
@@ -1,387 +0,0 @@
1
- const { checkAutoComplete } = require('../../lib/whatwg/check-autocomplete');
2
-
3
- const check = checkAutoComplete();
4
-
5
- test('basic', () => {
6
- expect(check('on').matched).toBe(true);
7
- expect(check('on webauthn').matched).toBe(false);
8
- expect(check('off').matched).toBe(true);
9
- expect(check('off webauthn').matched).toBe(false);
10
- expect(check('name').matched).toBe(true);
11
- expect(check('given-name').matched).toBe(true);
12
- expect(check('given-name webauthn').matched).toBe(true);
13
- expect(check('given-name webauthun').matched).toBe(false);
14
- expect(check('section-').matched).toBe(true);
15
- expect(check('section-foo').matched).toBe(true);
16
- expect(check('section-foo webauthn').matched).toBe(true);
17
- expect(check('section-foo name').matched).toBe(true);
18
- expect(check('section-foo name webauthn').matched).toBe(true);
19
- expect(check('section-foo shipping name').matched).toBe(true);
20
- expect(check('section-foo billing name').matched).toBe(true);
21
- expect(check('section-foo billing home').matched).toBe(true);
22
- expect(check('section-foo billing work').matched).toBe(true);
23
- expect(check('section-foo billing home tel').matched).toBe(true);
24
- expect(check('section-foo billing work email').matched).toBe(true);
25
- expect(check('section-foo billing work email webauthn').matched).toBe(true);
26
- expect(check('shipping name').matched).toBe(true);
27
- expect(check('billing name').matched).toBe(true);
28
- expect(check('billing home').matched).toBe(true);
29
- expect(check('billing work').matched).toBe(true);
30
- expect(check('billing home tel').matched).toBe(true);
31
- expect(check('billing work email').matched).toBe(true);
32
- expect(check('billing work email webauthn').matched).toBe(true);
33
- expect(check('home tel').matched).toBe(true);
34
- expect(check('work email').matched).toBe(true);
35
- expect(check('work email webauthn').matched).toBe(true);
36
- });
37
-
38
- test('unexpected-token', () => {
39
- expect(check('section-foo , name')).toStrictEqual({
40
- matched: false,
41
- raw: ',',
42
- offset: 12,
43
- length: 1,
44
- line: 1,
45
- column: 13,
46
- reason: 'unexpected-token',
47
- expects: [
48
- { type: 'const', value: 'billing' },
49
- { type: 'const', value: 'shipping' },
50
- { type: 'common', value: 'autofill field name' },
51
- ],
52
- candidate: undefined,
53
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
54
- });
55
- });
56
-
57
- test('unexpected-token', () => {
58
- expect(check('xxx')).toStrictEqual({
59
- matched: false,
60
- raw: 'xxx',
61
- offset: 0,
62
- length: 3,
63
- line: 1,
64
- column: 1,
65
- reason: 'unexpected-token',
66
- expects: [
67
- { type: 'common', value: 'autofill named group' },
68
- { type: 'common', value: 'autofill field name' },
69
- ],
70
- candidate: undefined,
71
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
72
- });
73
- });
74
-
75
- test('unexpected-token', () => {
76
- expect(check('section-foo neme')).toStrictEqual({
77
- matched: false,
78
- raw: 'neme',
79
- offset: 12,
80
- length: 4,
81
- line: 1,
82
- column: 13,
83
- reason: 'unexpected-token',
84
- expects: [
85
- { type: 'const', value: 'billing' },
86
- { type: 'const', value: 'shipping' },
87
- { type: 'common', value: 'autofill field name' },
88
- ],
89
- candidate: 'name',
90
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
91
- });
92
- expect(check('section-foo shipping neme')).toStrictEqual({
93
- matched: false,
94
- raw: 'neme',
95
- offset: 21,
96
- length: 4,
97
- line: 1,
98
- column: 22,
99
- reason: 'unexpected-token',
100
- expects: [
101
- { type: 'common', value: 'autofill field name' },
102
- { type: 'const', value: 'home' },
103
- { type: 'const', value: 'work' },
104
- { type: 'const', value: 'mobile' },
105
- { type: 'const', value: 'fax' },
106
- { type: 'const', value: 'pager' },
107
- ],
108
- candidate: 'name',
109
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
110
- });
111
- expect(check('section-foo shipping home name')).toStrictEqual({
112
- matched: false,
113
- raw: 'name',
114
- offset: 26,
115
- length: 4,
116
- line: 1,
117
- column: 27,
118
- reason: 'unexpected-token',
119
- expects: [
120
- { type: 'const', value: 'tel' },
121
- { type: 'const', value: 'tel-country-code' },
122
- { type: 'const', value: 'tel-national' },
123
- { type: 'const', value: 'tel-area-code' },
124
- { type: 'const', value: 'tel-local' },
125
- { type: 'const', value: 'tel-local-prefix' },
126
- { type: 'const', value: 'tel-local-suffix' },
127
- { type: 'const', value: 'tel-extension' },
128
- { type: 'const', value: 'email' },
129
- { type: 'const', value: 'impp' },
130
- ],
131
- candidate: undefined,
132
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-tel',
133
- });
134
- expect(check('section-foo shipping home emall')).toStrictEqual({
135
- matched: false,
136
- raw: 'emall',
137
- offset: 26,
138
- length: 5,
139
- line: 1,
140
- column: 27,
141
- reason: 'unexpected-token',
142
- expects: [
143
- { type: 'const', value: 'tel' },
144
- { type: 'const', value: 'tel-country-code' },
145
- { type: 'const', value: 'tel-national' },
146
- { type: 'const', value: 'tel-area-code' },
147
- { type: 'const', value: 'tel-local' },
148
- { type: 'const', value: 'tel-local-prefix' },
149
- { type: 'const', value: 'tel-local-suffix' },
150
- { type: 'const', value: 'tel-extension' },
151
- { type: 'const', value: 'email' },
152
- { type: 'const', value: 'impp' },
153
- ],
154
- candidate: 'email',
155
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-tel',
156
- });
157
- });
158
-
159
- test('duplicated', () => {
160
- expect(check('name name')).toStrictEqual({
161
- matched: false,
162
- raw: 'name',
163
- offset: 5,
164
- length: 4,
165
- line: 1,
166
- column: 6,
167
- partName: 'the content of the list',
168
- reason: 'duplicated',
169
- expects: [{ type: 'format', value: 'autocomplete' }],
170
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-autocomplete',
171
- });
172
- expect(check('on on')).toStrictEqual({
173
- matched: false,
174
- raw: 'on',
175
- offset: 3,
176
- length: 2,
177
- line: 1,
178
- column: 4,
179
- partName: 'the content of the list',
180
- reason: 'duplicated',
181
- expects: [{ type: 'format', value: 'autocomplete' }],
182
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-autocomplete',
183
- });
184
- });
185
-
186
- test('extra-token', () => {
187
- expect(check('on off')).toStrictEqual({
188
- matched: false,
189
- raw: 'off',
190
- offset: 3,
191
- length: 3,
192
- line: 1,
193
- column: 4,
194
- reason: 'extra-token',
195
- expects: [{ type: 'format', value: 'autocomplete' }],
196
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-on-2',
197
- });
198
- expect(check('off on')).toStrictEqual({
199
- matched: false,
200
- raw: 'on',
201
- offset: 4,
202
- length: 2,
203
- line: 1,
204
- column: 5,
205
- reason: 'extra-token',
206
- expects: [{ type: 'format', value: 'autocomplete' }],
207
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-on-2',
208
- });
209
- expect(check('on name')).toStrictEqual({
210
- matched: false,
211
- raw: 'name',
212
- offset: 3,
213
- length: 4,
214
- line: 1,
215
- column: 4,
216
- reason: 'extra-token',
217
- expects: [{ type: 'format', value: 'autocomplete' }],
218
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-on-2',
219
- });
220
- expect(check('name on')).toStrictEqual({
221
- matched: false,
222
- raw: 'on',
223
- offset: 5,
224
- length: 2,
225
- line: 1,
226
- column: 6,
227
- reason: 'extra-token',
228
- expects: [{ type: 'format', value: 'autocomplete' }],
229
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
230
- });
231
- expect(check('section-foo name on')).toStrictEqual({
232
- matched: false,
233
- raw: 'on',
234
- offset: 17,
235
- length: 2,
236
- line: 1,
237
- column: 18,
238
- reason: 'extra-token',
239
- expects: [{ type: 'format', value: 'autocomplete' }],
240
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
241
- });
242
- expect(check('section-foo billing name on')).toStrictEqual({
243
- matched: false,
244
- raw: 'on',
245
- offset: 25,
246
- length: 2,
247
- line: 1,
248
- column: 26,
249
- reason: 'extra-token',
250
- expects: [{ type: 'format', value: 'autocomplete' }],
251
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
252
- });
253
- expect(check('billing name on')).toStrictEqual({
254
- matched: false,
255
- raw: 'on',
256
- offset: 13,
257
- length: 2,
258
- line: 1,
259
- column: 14,
260
- reason: 'extra-token',
261
- expects: [{ type: 'format', value: 'autocomplete' }],
262
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
263
- });
264
- expect(check('tel on')).toStrictEqual({
265
- matched: false,
266
- raw: 'on',
267
- offset: 4,
268
- length: 2,
269
- line: 1,
270
- column: 5,
271
- reason: 'extra-token',
272
- expects: [{ type: 'format', value: 'autocomplete' }],
273
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
274
- });
275
- expect(check('home tel on')).toStrictEqual({
276
- matched: false,
277
- raw: 'on',
278
- offset: 9,
279
- length: 2,
280
- line: 1,
281
- column: 10,
282
- reason: 'extra-token',
283
- expects: [{ type: 'format', value: 'autocomplete' }],
284
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
285
- });
286
- expect(check('billing home tel on')).toStrictEqual({
287
- matched: false,
288
- raw: 'on',
289
- offset: 17,
290
- length: 2,
291
- line: 1,
292
- column: 18,
293
- reason: 'extra-token',
294
- expects: [{ type: 'format', value: 'autocomplete' }],
295
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
296
- });
297
- expect(check('billing home tel on')).toStrictEqual({
298
- matched: false,
299
- raw: 'on',
300
- offset: 17,
301
- length: 2,
302
- line: 1,
303
- column: 18,
304
- reason: 'extra-token',
305
- expects: [{ type: 'format', value: 'autocomplete' }],
306
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
307
- });
308
- expect(check('section-foo billing home tel on')).toStrictEqual({
309
- matched: false,
310
- raw: 'on',
311
- offset: 29,
312
- length: 2,
313
- line: 1,
314
- column: 30,
315
- reason: 'extra-token',
316
- expects: [{ type: 'format', value: 'autocomplete' }],
317
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
318
- });
319
- expect(check('section-foo home tel on')).toStrictEqual({
320
- matched: false,
321
- raw: 'on',
322
- offset: 21,
323
- length: 2,
324
- line: 1,
325
- column: 22,
326
- reason: 'extra-token',
327
- expects: [{ type: 'format', value: 'autocomplete' }],
328
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
329
- });
330
- expect(check('section-foo tel on')).toStrictEqual({
331
- matched: false,
332
- raw: 'on',
333
- offset: 16,
334
- length: 2,
335
- line: 1,
336
- column: 17,
337
- reason: 'extra-token',
338
- expects: [{ type: 'format', value: 'autocomplete' }],
339
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
340
- });
341
- });
342
-
343
- test('duplicated section', () => {
344
- expect(check('section-foo section-bar')).toStrictEqual({
345
- matched: false,
346
- raw: 'section-bar',
347
- offset: 12,
348
- length: 11,
349
- line: 1,
350
- column: 13,
351
- partName: 'autofill named group',
352
- reason: 'duplicated',
353
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-autocomplete-section',
354
- });
355
- });
356
-
357
- test('duplicated part', () => {
358
- expect(check('shipping billing')).toStrictEqual({
359
- matched: false,
360
- raw: 'billing',
361
- offset: 9,
362
- length: 7,
363
- line: 1,
364
- column: 10,
365
- reason: 'duplicated',
366
- expects: [{ type: 'format', value: 'autocomplete' }],
367
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-autocomplete-shipping',
368
- });
369
- });
370
-
371
- test('typo', () => {
372
- expect(check('secsion-foo name')).toStrictEqual({
373
- matched: false,
374
- raw: 'secsion-foo',
375
- offset: 0,
376
- length: 11,
377
- line: 1,
378
- column: 1,
379
- reason: 'unexpected-token',
380
- expects: [
381
- { type: 'common', value: 'autofill named group' },
382
- { type: 'common', value: 'autofill field name' },
383
- ],
384
- candidate: 'section-foo',
385
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
386
- });
387
- });