@lingual/i18n-check 0.8.2 → 0.8.4

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