@lingual/i18n-check 0.7.5 → 0.8.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.
@@ -19,93 +19,108 @@ describe("nextIntlSrcParser", () => {
19
19
  const keys = (0, nextIntlSrcParser_1.extract)([basicFile, counterFile, clientCounterFile]);
20
20
  expect(keys).toEqual([
21
21
  {
22
- key: "ClientCounter2.increment",
22
+ key: "ClientCounter.count",
23
23
  meta: {
24
24
  file: clientCounterFile,
25
+ namespace: "ClientCounter",
25
26
  },
26
27
  },
27
28
  {
28
- key: "ClientCounter2.count",
29
+ key: "ClientCounter.increment",
29
30
  meta: {
30
31
  file: clientCounterFile,
32
+ namespace: "ClientCounter",
31
33
  },
32
34
  },
33
35
  {
34
- key: "ClientCounter.increment",
36
+ key: "ClientCounter2.count",
35
37
  meta: {
36
38
  file: clientCounterFile,
39
+ namespace: "ClientCounter2",
37
40
  },
38
41
  },
39
42
  {
40
- key: "ClientCounter.count",
43
+ key: "ClientCounter2.increment",
41
44
  meta: {
42
45
  file: clientCounterFile,
46
+ namespace: "ClientCounter2",
43
47
  },
44
48
  },
45
49
  {
46
- key: "Counter.increment",
50
+ key: "Counter.count",
47
51
  meta: {
48
52
  file: counterFile,
53
+ namespace: "Counter",
49
54
  },
50
55
  },
51
56
  {
52
- key: "Counter.count",
57
+ key: "Counter.increment",
53
58
  meta: {
54
59
  file: counterFile,
60
+ namespace: "Counter",
55
61
  },
56
62
  },
57
63
  {
58
- key: "testKeyWithoutNamespace",
64
+ key: "Navigation.about",
59
65
  meta: {
60
66
  file: basicFile,
67
+ namespace: "Navigation",
61
68
  },
62
69
  },
63
70
  {
64
- key: "message.argument",
71
+ key: "Navigation.client",
65
72
  meta: {
66
73
  file: basicFile,
74
+ namespace: "Navigation",
67
75
  },
68
76
  },
69
77
  {
70
- key: "message.select",
78
+ key: "Navigation.home",
71
79
  meta: {
72
80
  file: basicFile,
81
+ namespace: "Navigation",
73
82
  },
74
83
  },
75
84
  {
76
- key: "message.simple",
85
+ key: "Navigation.nested",
77
86
  meta: {
78
87
  file: basicFile,
88
+ namespace: "Navigation",
79
89
  },
80
90
  },
81
91
  {
82
92
  key: "Navigation.news",
83
93
  meta: {
84
94
  file: basicFile,
95
+ namespace: "Navigation",
85
96
  },
86
97
  },
87
98
  {
88
- key: "Navigation.nested",
99
+ key: "message.argument",
89
100
  meta: {
90
101
  file: basicFile,
102
+ namespace: "message",
91
103
  },
92
104
  },
93
105
  {
94
- key: "Navigation.about",
106
+ key: "message.select",
95
107
  meta: {
96
108
  file: basicFile,
109
+ namespace: "message",
97
110
  },
98
111
  },
99
112
  {
100
- key: "Navigation.client",
113
+ key: "message.simple",
101
114
  meta: {
102
115
  file: basicFile,
116
+ namespace: "message",
103
117
  },
104
118
  },
105
119
  {
106
- key: "Navigation.home",
120
+ key: "testKeyWithoutNamespace",
107
121
  meta: {
108
122
  file: basicFile,
123
+ namespace: "",
109
124
  },
110
125
  },
111
126
  ]);
@@ -114,87 +129,101 @@ describe("nextIntlSrcParser", () => {
114
129
  const keys = (0, nextIntlSrcParser_1.extract)([nestedExampleFile]);
115
130
  expect(keys).toEqual([
116
131
  {
117
- key: "nested.three.htmlKey",
132
+ key: "deepNested.level1.one",
118
133
  meta: {
119
134
  file: "translations/codeExamples/next-intl/src/NestedExample.tsx",
135
+ namespace: "deepNested.level1",
120
136
  },
121
137
  },
122
138
  {
123
- key: "nested.three.markupKey",
139
+ key: "deepNested.level2.two",
124
140
  meta: {
125
141
  file: "translations/codeExamples/next-intl/src/NestedExample.tsx",
142
+ namespace: "deepNested.level2",
126
143
  },
127
144
  },
128
145
  {
129
- key: "nested.three.richTextKey",
146
+ key: "deepNested.level3.three",
130
147
  meta: {
131
148
  file: "translations/codeExamples/next-intl/src/NestedExample.tsx",
149
+ namespace: "deepNested.level3",
132
150
  },
133
151
  },
134
152
  {
135
- key: "nested.three.hasKeyCheck",
153
+ key: "deepNested.level4.four",
136
154
  meta: {
137
155
  file: "translations/codeExamples/next-intl/src/NestedExample.tsx",
156
+ namespace: "deepNested.level4",
138
157
  },
139
158
  },
140
159
  {
141
- key: "nested.three.basicKey",
160
+ key: "nested.nested.two.nestedTwoKey",
142
161
  meta: {
143
162
  file: "translations/codeExamples/next-intl/src/NestedExample.tsx",
163
+ namespace: "nested.nested.two",
144
164
  },
145
165
  },
146
166
  {
147
- key: "deepNested.level1.one",
167
+ key: "nested.one.nestedKey",
148
168
  meta: {
149
169
  file: "translations/codeExamples/next-intl/src/NestedExample.tsx",
170
+ namespace: "nested.one",
150
171
  },
151
172
  },
152
173
  {
153
- key: "deepNested.level2.two",
174
+ key: "nested.one.regularKey",
154
175
  meta: {
155
176
  file: "translations/codeExamples/next-intl/src/NestedExample.tsx",
177
+ namespace: "nested.one",
156
178
  },
157
179
  },
158
180
  {
159
- key: "deepNested.level3.three",
181
+ key: "nested.three.basicKey",
160
182
  meta: {
161
183
  file: "translations/codeExamples/next-intl/src/NestedExample.tsx",
184
+ namespace: "nested.three",
162
185
  },
163
186
  },
164
187
  {
165
- key: "deepNested.level4.four",
188
+ key: "nested.three.hasKeyCheck",
166
189
  meta: {
167
190
  file: "translations/codeExamples/next-intl/src/NestedExample.tsx",
191
+ namespace: "nested.three",
168
192
  },
169
193
  },
170
194
  {
171
- key: "nested.two.regularKey",
195
+ key: "nested.three.htmlKey",
172
196
  meta: {
173
197
  file: "translations/codeExamples/next-intl/src/NestedExample.tsx",
198
+ namespace: "nested.three",
174
199
  },
175
200
  },
176
201
  {
177
- key: "nested.two.nestedKey",
202
+ key: "nested.three.markupKey",
178
203
  meta: {
179
204
  file: "translations/codeExamples/next-intl/src/NestedExample.tsx",
205
+ namespace: "nested.three",
180
206
  },
181
207
  },
182
208
  {
183
- key: "nested.nested.two.nestedTwoKey",
209
+ key: "nested.three.richTextKey",
184
210
  meta: {
185
211
  file: "translations/codeExamples/next-intl/src/NestedExample.tsx",
212
+ namespace: "nested.three",
186
213
  },
187
214
  },
188
215
  {
189
- key: "nested.one.regularKey",
216
+ key: "nested.two.nestedKey",
190
217
  meta: {
191
218
  file: "translations/codeExamples/next-intl/src/NestedExample.tsx",
219
+ namespace: "nested.two",
192
220
  },
193
221
  },
194
222
  {
195
- key: "nested.one.nestedKey",
223
+ key: "nested.two.regularKey",
196
224
  meta: {
197
225
  file: "translations/codeExamples/next-intl/src/NestedExample.tsx",
226
+ namespace: "nested.two",
198
227
  },
199
228
  },
200
229
  ]);
@@ -203,15 +232,17 @@ describe("nextIntlSrcParser", () => {
203
232
  const keys = (0, nextIntlSrcParser_1.extract)([asyncExampleFile]);
204
233
  expect(keys).toEqual([
205
234
  {
206
- key: "async.two.title",
235
+ key: "Async.title",
207
236
  meta: {
208
237
  file: "translations/codeExamples/next-intl/src/AsyncExample.tsx",
238
+ namespace: "Async",
209
239
  },
210
240
  },
211
241
  {
212
- key: "Async.title",
242
+ key: "async.two.title",
213
243
  meta: {
214
244
  file: "translations/codeExamples/next-intl/src/AsyncExample.tsx",
245
+ namespace: "async.two",
215
246
  },
216
247
  },
217
248
  ]);
@@ -220,87 +251,47 @@ describe("nextIntlSrcParser", () => {
220
251
  const keys = (0, nextIntlSrcParser_1.extract)([dynamicKeysExampleFile]);
221
252
  expect(keys).toEqual([
222
253
  {
223
- key: "dynamic.three.value",
224
- meta: {
225
- file: "translations/codeExamples/next-intl/src/DynamicKeysExample.tsx",
226
- },
227
- },
228
- {
229
- key: "dynamic.three.title",
230
- meta: {
231
- file: "translations/codeExamples/next-intl/src/DynamicKeysExample.tsx",
232
- },
233
- },
234
- {
235
- key: "dynamic.two.value",
236
- meta: {
237
- file: "translations/codeExamples/next-intl/src/DynamicKeysExample.tsx",
238
- },
239
- },
240
- {
241
- key: "dynamic.two.title",
242
- meta: {
243
- file: "translations/codeExamples/next-intl/src/DynamicKeysExample.tsx",
244
- },
245
- },
246
- {
247
- key: "dynamic.one.value",
248
- meta: {
249
- file: "translations/codeExamples/next-intl/src/DynamicKeysExample.tsx",
250
- },
251
- },
252
- {
253
- key: "dynamic.one.title",
254
- meta: {
255
- file: "translations/codeExamples/next-intl/src/DynamicKeysExample.tsx",
256
- },
257
- },
258
- {
259
- key: "dynamic.four.four",
254
+ key: "dynamic",
260
255
  meta: {
256
+ dynamic: true,
261
257
  file: "translations/codeExamples/next-intl/src/DynamicKeysExample.tsx",
258
+ namespace: "dynamic",
262
259
  },
263
260
  },
264
261
  {
265
- key: "dynamic.four.three",
262
+ key: "dynamic.four",
266
263
  meta: {
264
+ dynamic: true,
267
265
  file: "translations/codeExamples/next-intl/src/DynamicKeysExample.tsx",
266
+ namespace: "dynamic.four",
268
267
  },
269
268
  },
270
269
  {
271
- key: "dynamic.four.two",
272
- meta: {
273
- file: "translations/codeExamples/next-intl/src/DynamicKeysExample.tsx",
274
- },
275
- },
276
- {
277
- key: "dynamic.four.one",
270
+ key: "dynamic.four.nameFour",
278
271
  meta: {
279
272
  file: "translations/codeExamples/next-intl/src/DynamicKeysExample.tsx",
273
+ namespace: "dynamic.four",
280
274
  },
281
275
  },
282
276
  {
283
- key: "dynamic.four.nameFour",
277
+ key: "dynamic.four.nameOne",
284
278
  meta: {
285
279
  file: "translations/codeExamples/next-intl/src/DynamicKeysExample.tsx",
280
+ namespace: "dynamic.four",
286
281
  },
287
282
  },
288
283
  {
289
284
  key: "dynamic.four.nameThree",
290
285
  meta: {
291
286
  file: "translations/codeExamples/next-intl/src/DynamicKeysExample.tsx",
287
+ namespace: "dynamic.four",
292
288
  },
293
289
  },
294
290
  {
295
291
  key: "dynamic.four.nameTwo",
296
292
  meta: {
297
293
  file: "translations/codeExamples/next-intl/src/DynamicKeysExample.tsx",
298
- },
299
- },
300
- {
301
- key: "dynamic.four.nameOne",
302
- meta: {
303
- file: "translations/codeExamples/next-intl/src/DynamicKeysExample.tsx",
294
+ namespace: "dynamic.four",
304
295
  },
305
296
  },
306
297
  ]);
@@ -309,171 +300,199 @@ describe("nextIntlSrcParser", () => {
309
300
  const keys = (0, nextIntlSrcParser_1.extract)([strictTypesExample]);
310
301
  expect(keys).toEqual([
311
302
  {
312
- key: "unknown.unknown",
303
+ key: "About.lastUpdated",
313
304
  meta: {
314
305
  file: "translations/codeExamples/next-intl/src/StrictTypesExample.tsx",
306
+ namespace: "About",
315
307
  },
316
308
  },
317
309
  {
318
- key: "About.unknown",
310
+ key: "About.lastUpdated",
319
311
  meta: {
320
312
  file: "translations/codeExamples/next-intl/src/StrictTypesExample.tsx",
313
+ namespace: "About",
321
314
  },
322
315
  },
323
316
  {
324
- key: "unknown",
317
+ key: "About.title",
325
318
  meta: {
326
319
  file: "translations/codeExamples/next-intl/src/StrictTypesExample.tsx",
320
+ namespace: undefined,
327
321
  },
328
322
  },
329
323
  {
330
- key: "Test.title",
324
+ key: "About.title",
331
325
  meta: {
332
326
  file: "translations/codeExamples/next-intl/src/StrictTypesExample.tsx",
327
+ namespace: "About",
333
328
  },
334
329
  },
335
330
  {
336
- key: "title",
331
+ key: "About.title",
337
332
  meta: {
338
333
  file: "translations/codeExamples/next-intl/src/StrictTypesExample.tsx",
334
+ namespace: undefined,
339
335
  },
340
336
  },
341
337
  {
342
- key: "PageLayout.pageTitle",
338
+ key: "About.title",
343
339
  meta: {
344
340
  file: "translations/codeExamples/next-intl/src/StrictTypesExample.tsx",
341
+ namespace: "About",
345
342
  },
346
343
  },
347
344
  {
348
- key: "NotFound.title",
345
+ key: "About.unknown",
349
346
  meta: {
350
347
  file: "translations/codeExamples/next-intl/src/StrictTypesExample.tsx",
348
+ namespace: "About",
351
349
  },
352
350
  },
353
351
  {
354
- key: "Navigation.about",
352
+ key: "About.unknown",
355
353
  meta: {
356
354
  file: "translations/codeExamples/next-intl/src/StrictTypesExample.tsx",
355
+ namespace: "About",
357
356
  },
358
357
  },
359
358
  {
360
- key: "About.title",
359
+ key: "Navigation.about",
361
360
  meta: {
362
361
  file: "translations/codeExamples/next-intl/src/StrictTypesExample.tsx",
362
+ namespace: undefined,
363
363
  },
364
364
  },
365
365
  {
366
366
  key: "Navigation.about",
367
367
  meta: {
368
368
  file: "translations/codeExamples/next-intl/src/StrictTypesExample.tsx",
369
+ namespace: "Navigation",
369
370
  },
370
371
  },
371
372
  {
372
- key: "About.lastUpdated",
373
+ key: "Navigation.about",
373
374
  meta: {
374
375
  file: "translations/codeExamples/next-intl/src/StrictTypesExample.tsx",
376
+ namespace: undefined,
375
377
  },
376
378
  },
377
379
  {
378
- key: "About.title",
380
+ key: "Navigation.about",
379
381
  meta: {
380
382
  file: "translations/codeExamples/next-intl/src/StrictTypesExample.tsx",
383
+ namespace: "Navigation",
381
384
  },
382
385
  },
383
386
  {
384
- key: "StrictTypes.nested.another.level",
387
+ key: "NotFound.title",
385
388
  meta: {
386
389
  file: "translations/codeExamples/next-intl/src/StrictTypesExample.tsx",
390
+ namespace: "NotFound",
387
391
  },
388
392
  },
389
393
  {
390
- key: "StrictTypes.nested.hello",
394
+ key: "NotFound.title",
391
395
  meta: {
392
396
  file: "translations/codeExamples/next-intl/src/StrictTypesExample.tsx",
397
+ namespace: "NotFound",
393
398
  },
394
399
  },
395
400
  {
396
- key: "unknown.unknown",
401
+ key: "PageLayout.pageTitle",
397
402
  meta: {
398
403
  file: "translations/codeExamples/next-intl/src/StrictTypesExample.tsx",
404
+ namespace: "PageLayout",
399
405
  },
400
406
  },
401
407
  {
402
- key: "About.unknown",
408
+ key: "PageLayout.pageTitle",
403
409
  meta: {
404
410
  file: "translations/codeExamples/next-intl/src/StrictTypesExample.tsx",
411
+ namespace: "PageLayout",
405
412
  },
406
413
  },
407
414
  {
408
- key: "unknown",
415
+ key: "StrictTypes.nested.another.level",
409
416
  meta: {
410
417
  file: "translations/codeExamples/next-intl/src/StrictTypesExample.tsx",
418
+ namespace: "StrictTypes.nested",
411
419
  },
412
420
  },
413
421
  {
414
- key: "Test.title",
422
+ key: "StrictTypes.nested.another.level",
415
423
  meta: {
416
424
  file: "translations/codeExamples/next-intl/src/StrictTypesExample.tsx",
425
+ namespace: "StrictTypes.nested",
417
426
  },
418
427
  },
419
428
  {
420
- key: "title",
429
+ key: "StrictTypes.nested.hello",
421
430
  meta: {
422
431
  file: "translations/codeExamples/next-intl/src/StrictTypesExample.tsx",
432
+ namespace: "StrictTypes",
423
433
  },
424
434
  },
425
435
  {
426
- key: "PageLayout.pageTitle",
436
+ key: "StrictTypes.nested.hello",
427
437
  meta: {
428
438
  file: "translations/codeExamples/next-intl/src/StrictTypesExample.tsx",
439
+ namespace: "StrictTypes",
429
440
  },
430
441
  },
431
442
  {
432
- key: "NotFound.title",
443
+ key: "Test.title",
433
444
  meta: {
434
445
  file: "translations/codeExamples/next-intl/src/StrictTypesExample.tsx",
446
+ namespace: "Test",
435
447
  },
436
448
  },
437
449
  {
438
- key: "Navigation.about",
450
+ key: "Test.title",
439
451
  meta: {
440
452
  file: "translations/codeExamples/next-intl/src/StrictTypesExample.tsx",
453
+ namespace: "Test",
441
454
  },
442
455
  },
443
456
  {
444
- key: "About.title",
457
+ key: "title",
445
458
  meta: {
446
459
  file: "translations/codeExamples/next-intl/src/StrictTypesExample.tsx",
460
+ namespace: undefined,
447
461
  },
448
462
  },
449
463
  {
450
- key: "Navigation.about",
464
+ key: "title",
451
465
  meta: {
452
466
  file: "translations/codeExamples/next-intl/src/StrictTypesExample.tsx",
467
+ namespace: undefined,
453
468
  },
454
469
  },
455
470
  {
456
- key: "About.lastUpdated",
471
+ key: "unknown",
457
472
  meta: {
458
473
  file: "translations/codeExamples/next-intl/src/StrictTypesExample.tsx",
474
+ namespace: undefined,
459
475
  },
460
476
  },
461
477
  {
462
- key: "About.title",
478
+ key: "unknown",
463
479
  meta: {
464
480
  file: "translations/codeExamples/next-intl/src/StrictTypesExample.tsx",
481
+ namespace: undefined,
465
482
  },
466
483
  },
467
484
  {
468
- key: "StrictTypes.nested.another.level",
485
+ key: "unknown.unknown",
469
486
  meta: {
470
487
  file: "translations/codeExamples/next-intl/src/StrictTypesExample.tsx",
488
+ namespace: "unknown",
471
489
  },
472
490
  },
473
491
  {
474
- key: "StrictTypes.nested.hello",
492
+ key: "unknown.unknown",
475
493
  meta: {
476
494
  file: "translations/codeExamples/next-intl/src/StrictTypesExample.tsx",
495
+ namespace: "unknown",
477
496
  },
478
497
  },
479
498
  ]);
@@ -482,57 +501,66 @@ describe("nextIntlSrcParser", () => {
482
501
  const keys = (0, nextIntlSrcParser_1.extract)([advancedExample]);
483
502
  expect(keys).toEqual([
484
503
  {
485
- key: "aliasNestedOne.one",
504
+ key: "aliasNestedFour.four",
486
505
  meta: {
487
506
  file: advancedExample,
507
+ namespace: "aliasNestedFour",
488
508
  },
489
509
  },
490
510
  {
491
- key: "aliasNestedTwo.two",
511
+ key: "aliasNestedOne.one",
492
512
  meta: {
493
513
  file: advancedExample,
514
+ namespace: "aliasNestedOne",
494
515
  },
495
516
  },
496
517
  {
497
- key: "aliasNestedThree.threeThree",
518
+ key: "aliasNestedOne.threeOne",
498
519
  meta: {
499
520
  file: advancedExample,
521
+ namespace: "aliasNestedOne",
500
522
  },
501
523
  },
502
524
  {
503
- key: "aliasNestedTwo.threeTwo",
525
+ key: "aliasNestedThree.three",
504
526
  meta: {
505
527
  file: advancedExample,
528
+ namespace: "aliasNestedThree",
506
529
  },
507
530
  },
508
531
  {
509
- key: "aliasNestedOne.threeOne",
532
+ key: "aliasNestedThree.threeThree",
510
533
  meta: {
511
534
  file: advancedExample,
535
+ namespace: "aliasNestedThree",
512
536
  },
513
537
  },
514
538
  {
515
- key: "aliasNestedThree.three",
539
+ key: "aliasNestedTwo.threeTwo",
516
540
  meta: {
517
541
  file: advancedExample,
542
+ namespace: "aliasNestedTwo",
518
543
  },
519
544
  },
520
545
  {
521
- key: "aliasNestedFour.four",
546
+ key: "aliasNestedTwo.two",
522
547
  meta: {
523
548
  file: advancedExample,
549
+ namespace: "aliasNestedTwo",
524
550
  },
525
551
  },
526
552
  {
527
- key: "aliasTwo.keyTwo",
553
+ key: "aliasOne.keyOne",
528
554
  meta: {
529
555
  file: advancedExample,
556
+ namespace: "aliasOne",
530
557
  },
531
558
  },
532
559
  {
533
- key: "aliasOne.keyOne",
560
+ key: "aliasTwo.keyTwo",
534
561
  meta: {
535
562
  file: advancedExample,
563
+ namespace: "aliasTwo",
536
564
  },
537
565
  },
538
566
  ]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingual/i18n-check",
3
- "version": "0.7.5",
3
+ "version": "0.8.0",
4
4
  "description": "i18n translation messages check",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",