@comment-labs/oxlint-config 1.0.0-beta.8 → 1.0.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.
@@ -1,2 +1,899 @@
1
- import eslint_plugin_i18next_default from "eslint-plugin-i18next";
2
- export { eslint_plugin_i18next_default as default };
1
+ //#region src/plugin/i18next/constants.ts
2
+ const DOM_TAGS = [
3
+ "a",
4
+ "abbr",
5
+ "acronym",
6
+ "applet",
7
+ "area",
8
+ "article",
9
+ "aside",
10
+ "audio",
11
+ "b",
12
+ "base",
13
+ "basefont",
14
+ "bdi",
15
+ "bdo",
16
+ "big",
17
+ "blockquote",
18
+ "body",
19
+ "br",
20
+ "button",
21
+ "canvas",
22
+ "caption",
23
+ "center",
24
+ "cite",
25
+ "code",
26
+ "col",
27
+ "colgroup",
28
+ "data",
29
+ "datalist",
30
+ "dd",
31
+ "del",
32
+ "details",
33
+ "dfn",
34
+ "dialog",
35
+ "dir",
36
+ "div",
37
+ "dl",
38
+ "dt",
39
+ "em",
40
+ "embed",
41
+ "fieldset",
42
+ "figcaption",
43
+ "figure",
44
+ "font",
45
+ "footer",
46
+ "form",
47
+ "frame",
48
+ "frameset",
49
+ "h1 to h6",
50
+ "head",
51
+ "header",
52
+ "hr",
53
+ "html",
54
+ "i",
55
+ "iframe",
56
+ "img",
57
+ "input",
58
+ "ins",
59
+ "kbd",
60
+ "label",
61
+ "legend",
62
+ "li",
63
+ "link",
64
+ "main",
65
+ "map",
66
+ "mark",
67
+ "meta",
68
+ "meter",
69
+ "nav",
70
+ "noframes",
71
+ "noscript",
72
+ "object",
73
+ "ol",
74
+ "optgroup",
75
+ "option",
76
+ "output",
77
+ "p",
78
+ "param",
79
+ "picture",
80
+ "pre",
81
+ "progress",
82
+ "q",
83
+ "rp",
84
+ "rt",
85
+ "ruby",
86
+ "s",
87
+ "samp",
88
+ "script",
89
+ "section",
90
+ "select",
91
+ "small",
92
+ "source",
93
+ "span",
94
+ "strike",
95
+ "strong",
96
+ "style",
97
+ "sub",
98
+ "summary",
99
+ "sup",
100
+ "svg",
101
+ "table",
102
+ "tbody",
103
+ "td",
104
+ "template",
105
+ "textarea",
106
+ "tfoot",
107
+ "th",
108
+ "thead",
109
+ "time",
110
+ "title",
111
+ "tr",
112
+ "track",
113
+ "tt",
114
+ "u",
115
+ "ul",
116
+ "var",
117
+ "video",
118
+ "wbr"
119
+ ];
120
+ const SVG_TAGS = [
121
+ "a",
122
+ "animate",
123
+ "animateMotion",
124
+ "animateTransform",
125
+ "circle",
126
+ "clipPath",
127
+ "color-profile",
128
+ "defs",
129
+ "desc",
130
+ "discard",
131
+ "ellipse",
132
+ "feBlend",
133
+ "feColorMatrix",
134
+ "feComponentTransfer",
135
+ "feComposite",
136
+ "feConvolveMatrix",
137
+ "feDiffuseLighting",
138
+ "feDisplacementMap",
139
+ "feDistantLight",
140
+ "feDropShadow",
141
+ "feFlood",
142
+ "feFuncA",
143
+ "feFuncB",
144
+ "feFuncG",
145
+ "feFuncR",
146
+ "feGaussianBlur",
147
+ "feImage",
148
+ "feMerge",
149
+ "feMergeNode",
150
+ "feMorphology",
151
+ "feOffset",
152
+ "fePointLight",
153
+ "feSpecularLighting",
154
+ "feSpotLight",
155
+ "feTile",
156
+ "feTurbulence",
157
+ "filter",
158
+ "foreignObject",
159
+ "g",
160
+ "hatch",
161
+ "hatchpath",
162
+ "image",
163
+ "line",
164
+ "linearGradient",
165
+ "marker",
166
+ "mask",
167
+ "mesh",
168
+ "meshgradient",
169
+ "meshpatch",
170
+ "meshrow",
171
+ "metadata",
172
+ "mpath",
173
+ "path",
174
+ "pattern",
175
+ "polygon",
176
+ "polyline",
177
+ "radialGradient",
178
+ "rect",
179
+ "script",
180
+ "set",
181
+ "solidcolor",
182
+ "stop",
183
+ "style",
184
+ "svg",
185
+ "switch",
186
+ "symbol",
187
+ "text",
188
+ "textPath",
189
+ "title",
190
+ "tspan",
191
+ "unknown",
192
+ "use",
193
+ "view"
194
+ ];
195
+ //#endregion
196
+ //#region src/plugin/i18next/helpers.ts
197
+ const UPPERCASE_REGEX = /^[A-Z_-]+$/u;
198
+ function isUpperCase(str) {
199
+ return UPPERCASE_REGEX.test(str);
200
+ }
201
+ function isNativeDOMTag(str) {
202
+ return DOM_TAGS.includes(str);
203
+ }
204
+ function isSvgTag(str) {
205
+ return SVG_TAGS.includes(str);
206
+ }
207
+ const BLACKLIST_ATTRS = [
208
+ "placeholder",
209
+ "alt",
210
+ "aria-label",
211
+ "value",
212
+ "title"
213
+ ];
214
+ function isAllowedDOMAttr(tag, attr) {
215
+ if (isSvgTag(tag)) return true;
216
+ if (isNativeDOMTag(tag)) return !BLACKLIST_ATTRS.includes(attr);
217
+ return false;
218
+ }
219
+ function generateFullMatchRegExp(source) {
220
+ if (source instanceof RegExp) return source;
221
+ if (typeof source !== "string") throw new TypeError(`generateFullMatchRegExp: expected string but got ${String(source)}`);
222
+ return new RegExp(`^${source}${source.endsWith("$") ? "" : "$"}`);
223
+ }
224
+ const patternCache = /* @__PURE__ */ new WeakMap();
225
+ function matchPatterns(patterns, text) {
226
+ let handler = patternCache.get(patterns);
227
+ if (!handler) {
228
+ handler = (str) => patterns.map(generateFullMatchRegExp).some((item) => item.test(str));
229
+ patternCache.set(patterns, handler);
230
+ }
231
+ return handler(text);
232
+ }
233
+ function shouldSkip({ exclude = [], include = [] }, text) {
234
+ if (!include.length && !exclude.length) return false;
235
+ if (include.length && matchPatterns(include, text)) return false;
236
+ if (exclude.length && !matchPatterns(exclude, text)) return false;
237
+ return true;
238
+ }
239
+ function getNearestAncestor(node, type) {
240
+ let temp = node.parent;
241
+ while (temp) {
242
+ if (temp.type === type) return temp;
243
+ temp = temp.parent;
244
+ }
245
+ return null;
246
+ }
247
+ //#endregion
248
+ //#region src/plugin/i18next/options.ts
249
+ const defaults = {
250
+ framework: "react",
251
+ mode: "jsx-text-only",
252
+ "jsx-components": {
253
+ include: [],
254
+ exclude: ["Trans"]
255
+ },
256
+ "jsx-attributes": {
257
+ include: [],
258
+ exclude: [
259
+ "className",
260
+ "styleName",
261
+ "style",
262
+ "type",
263
+ "key",
264
+ "id",
265
+ "width",
266
+ "height"
267
+ ]
268
+ },
269
+ words: { exclude: [
270
+ "[0-9!-/:-@[-`{-~]+",
271
+ "[A-Z_-]+",
272
+ new RegExp(`^(${Object.values({
273
+ quot: "\"",
274
+ amp: "&",
275
+ apos: "'",
276
+ lt: "<",
277
+ gt: ">",
278
+ nbsp: "\xA0",
279
+ iexcl: "¡",
280
+ cent: "¢",
281
+ pound: "£",
282
+ curren: "¤",
283
+ yen: "¥",
284
+ brvbar: "¦",
285
+ sect: "§",
286
+ uml: "¨",
287
+ copy: "©",
288
+ ordf: "ª",
289
+ laquo: "«",
290
+ not: "¬",
291
+ shy: "­",
292
+ reg: "®",
293
+ macr: "¯",
294
+ deg: "°",
295
+ plusmn: "±",
296
+ sup2: "²",
297
+ sup3: "³",
298
+ acute: "´",
299
+ micro: "µ",
300
+ para: "¶",
301
+ middot: "·",
302
+ cedil: "¸",
303
+ sup1: "¹",
304
+ ordm: "º",
305
+ raquo: "»",
306
+ frac14: "¼",
307
+ frac12: "½",
308
+ frac34: "¾",
309
+ iquest: "¿",
310
+ Agrave: "À",
311
+ Aacute: "Á",
312
+ Acirc: "Â",
313
+ Atilde: "Ã",
314
+ Auml: "Ä",
315
+ Aring: "Å",
316
+ AElig: "Æ",
317
+ Ccedil: "Ç",
318
+ Egrave: "È",
319
+ Eacute: "É",
320
+ Ecirc: "Ê",
321
+ Euml: "Ë",
322
+ Igrave: "Ì",
323
+ Iacute: "Í",
324
+ Icirc: "Î",
325
+ Iuml: "Ï",
326
+ ETH: "Ð",
327
+ Ntilde: "Ñ",
328
+ Ograve: "Ò",
329
+ Oacute: "Ó",
330
+ Ocirc: "Ô",
331
+ Otilde: "Õ",
332
+ Ouml: "Ö",
333
+ times: "×",
334
+ Oslash: "Ø",
335
+ Ugrave: "Ù",
336
+ Uacute: "Ú",
337
+ Ucirc: "Û",
338
+ Uuml: "Ü",
339
+ Yacute: "Ý",
340
+ THORN: "Þ",
341
+ szlig: "ß",
342
+ agrave: "à",
343
+ aacute: "á",
344
+ acirc: "â",
345
+ atilde: "ã",
346
+ auml: "ä",
347
+ aring: "å",
348
+ aelig: "æ",
349
+ ccedil: "ç",
350
+ egrave: "è",
351
+ eacute: "é",
352
+ ecirc: "ê",
353
+ euml: "ë",
354
+ igrave: "ì",
355
+ iacute: "í",
356
+ icirc: "î",
357
+ iuml: "ï",
358
+ eth: "ð",
359
+ ntilde: "ñ",
360
+ ograve: "ò",
361
+ oacute: "ó",
362
+ ocirc: "ô",
363
+ otilde: "õ",
364
+ ouml: "ö",
365
+ divide: "÷",
366
+ oslash: "ø",
367
+ ugrave: "ù",
368
+ uacute: "ú",
369
+ ucirc: "û",
370
+ uuml: "ü",
371
+ yacute: "ý",
372
+ thorn: "þ",
373
+ yuml: "ÿ",
374
+ OElig: "Œ",
375
+ oelig: "œ",
376
+ Scaron: "Š",
377
+ scaron: "š",
378
+ Yuml: "Ÿ",
379
+ fnof: "ƒ",
380
+ circ: "ˆ",
381
+ tilde: "˜",
382
+ Alpha: "Α",
383
+ Beta: "Β",
384
+ Gamma: "Γ",
385
+ Delta: "Δ",
386
+ Epsilon: "Ε",
387
+ Zeta: "Ζ",
388
+ Eta: "Η",
389
+ Theta: "Θ",
390
+ Iota: "Ι",
391
+ Kappa: "Π",
392
+ Lambda: "Λ",
393
+ Mu: "Μ",
394
+ Nu: "Ν",
395
+ Xi: "Ξ",
396
+ Omicron: "Ο",
397
+ Pi: "Π",
398
+ Rho: "Ρ",
399
+ Sigma: "Σ",
400
+ Tau: "Τ",
401
+ Upsilon: "Υ",
402
+ Phi: "Φ",
403
+ Chi: "Χ",
404
+ Psi: "Ψ",
405
+ Omega: "Ω",
406
+ alpha: "α",
407
+ beta: "β",
408
+ gamma: "γ",
409
+ delta: "δ",
410
+ epsilon: "ε",
411
+ zeta: "ζ",
412
+ eta: "η",
413
+ theta: "θ",
414
+ iota: "ι",
415
+ kappa: "κ",
416
+ lambda: "λ",
417
+ mu: "μ",
418
+ nu: "ν",
419
+ xi: "ξ",
420
+ omicron: "ο",
421
+ pi: "π",
422
+ rho: "ρ",
423
+ sigmaf: "ς",
424
+ sigma: "σ",
425
+ tau: "τ",
426
+ upsilon: "υ",
427
+ phi: "φ",
428
+ chi: "χ",
429
+ psi: "ψ",
430
+ omega: "ω",
431
+ thetasym: "ϑ",
432
+ upsih: "ϒ",
433
+ piv: "ϖ",
434
+ ensp: " ",
435
+ emsp: " ",
436
+ thinsp: " ",
437
+ zwnj: "‌",
438
+ zwj: "‍",
439
+ lrm: "‎",
440
+ rlm: "‏",
441
+ ndash: "–",
442
+ mdash: "—",
443
+ lsquo: "‘",
444
+ rsquo: "’",
445
+ sbquo: "‚",
446
+ ldquo: "“",
447
+ rdquo: "”",
448
+ bdquo: "„",
449
+ dagger: "†",
450
+ Dagger: "‡",
451
+ bull: "•",
452
+ hellip: "…",
453
+ permil: "‰",
454
+ prime: "′",
455
+ Prime: "″",
456
+ lsaquo: "‹",
457
+ rsaquo: "›",
458
+ oline: "‾",
459
+ frasl: "⁄",
460
+ euro: "€",
461
+ image: "ℑ",
462
+ weierp: "℘",
463
+ real: "ℜ",
464
+ trade: "™",
465
+ alefsym: "ℵ",
466
+ larr: "←",
467
+ uarr: "↑",
468
+ rarr: "→",
469
+ darr: "↓",
470
+ harr: "↔",
471
+ crarr: "↵",
472
+ lArr: "⇐",
473
+ uArr: "⇑",
474
+ rArr: "⇒",
475
+ dArr: "⇓",
476
+ hArr: "⇔",
477
+ forall: "∀",
478
+ part: "∂",
479
+ exist: "∃",
480
+ empty: "∅",
481
+ nabla: "∇",
482
+ isin: "∈",
483
+ notin: "∉",
484
+ ni: "∋",
485
+ prod: "∏",
486
+ sum: "∑",
487
+ minus: "−",
488
+ lowast: "∗",
489
+ radic: "√",
490
+ prop: "∝",
491
+ infin: "∞",
492
+ ang: "∠",
493
+ and: "∧",
494
+ or: "∨",
495
+ cap: "∩",
496
+ cup: "∪",
497
+ int: "∫",
498
+ there4: "∴",
499
+ sim: "∼",
500
+ cong: "≅",
501
+ asymp: "≈",
502
+ ne: "≠",
503
+ equiv: "≡",
504
+ le: "≤",
505
+ ge: "≥",
506
+ sub: "⊂",
507
+ sup: "⊃",
508
+ nsub: "⊄",
509
+ sube: "⊆",
510
+ supe: "⊇",
511
+ oplus: "⊕",
512
+ otimes: "⊗",
513
+ perp: "⊥",
514
+ sdot: "⋅",
515
+ lceil: "⌈",
516
+ rceil: "⌉",
517
+ lfloor: "⌊",
518
+ rfloor: "⌋",
519
+ lang: "〈",
520
+ rang: "〉",
521
+ loz: "◊",
522
+ spades: "♠",
523
+ clubs: "♣",
524
+ hearts: "♥",
525
+ diams: "♦"
526
+ }).join("|")})+$`, "u"),
527
+ /^\p{Emoji}+$/u
528
+ ] },
529
+ callees: { exclude: [
530
+ "i18n(ext)?",
531
+ "t",
532
+ "require",
533
+ "addEventListener",
534
+ "removeEventListener",
535
+ "postMessage",
536
+ "getElementById",
537
+ "dispatch",
538
+ "commit",
539
+ "includes",
540
+ "indexOf",
541
+ "endsWith",
542
+ "startsWith"
543
+ ] },
544
+ "object-properties": {
545
+ include: [],
546
+ exclude: ["[A-Z_-]+"]
547
+ },
548
+ "class-properties": {
549
+ include: [],
550
+ exclude: ["displayName"]
551
+ },
552
+ message: "disallow literal string",
553
+ "should-validate-template": false
554
+ };
555
+ const schema = {
556
+ $schema: "http://json-schema.org/draft-07/schema#",
557
+ type: "object",
558
+ properties: {
559
+ framework: {
560
+ type: "string",
561
+ enum: ["react", "vue"]
562
+ },
563
+ mode: {
564
+ type: "string",
565
+ enum: [
566
+ "jsx-text-only",
567
+ "jsx-only",
568
+ "all",
569
+ "vue-template-only"
570
+ ]
571
+ },
572
+ "jsx-components": {
573
+ type: "object",
574
+ properties: {
575
+ include: { type: "array" },
576
+ exclude: { type: "array" }
577
+ }
578
+ },
579
+ "jsx-attributes": {
580
+ type: "object",
581
+ properties: {
582
+ include: { type: "array" },
583
+ exclude: { type: "array" }
584
+ }
585
+ },
586
+ words: {
587
+ type: "object",
588
+ properties: { exclude: { type: "array" } }
589
+ },
590
+ callees: {
591
+ type: "object",
592
+ properties: {
593
+ include: { type: "array" },
594
+ exclude: { type: "array" }
595
+ }
596
+ },
597
+ "object-properties": {
598
+ type: "object",
599
+ properties: {
600
+ include: { type: "array" },
601
+ exclude: { type: "array" }
602
+ }
603
+ },
604
+ "class-properties": {
605
+ type: "object",
606
+ properties: {
607
+ include: { type: "array" },
608
+ exclude: { type: "array" }
609
+ }
610
+ },
611
+ message: { type: "string" },
612
+ "should-validate-template": { type: "boolean" }
613
+ }
614
+ };
615
+ //#endregion
616
+ //#region src/plugin/i18next/no-literal-string.ts
617
+ function getSourceCode(context) {
618
+ return context.sourceCode ?? context.getSourceCode();
619
+ }
620
+ function getText(context, node) {
621
+ return getSourceCode(context).getText(node);
622
+ }
623
+ function getAncestors(context, node) {
624
+ return getSourceCode(context).getAncestors(node);
625
+ }
626
+ function withDottedPrefix(patterns = []) {
627
+ return patterns.map((item) => typeof item === "string" ? `(?:.*\\.)?${item}` : item);
628
+ }
629
+ function isValidFunctionCall(context, options, { callee }) {
630
+ if (callee.type === "Import") return true;
631
+ const sourceText = getText(context, callee);
632
+ const callees = options.callees ?? {};
633
+ return shouldSkip({
634
+ include: withDottedPrefix(callees.include),
635
+ exclude: withDottedPrefix(callees.exclude)
636
+ }, sourceText);
637
+ }
638
+ function isValidLiteral(options, { value }) {
639
+ if (typeof value !== "string") return true;
640
+ const trimmed = value.trim();
641
+ if (!trimmed) return true;
642
+ return shouldSkip(options.words ?? {}, trimmed);
643
+ }
644
+ function getAttributeName(node) {
645
+ if (!node.directive) return node.key.rawName;
646
+ const directiveKey = node.key;
647
+ if ((directiveKey.name.name === "bind" || directiveKey.name.name === "model") && directiveKey.argument && directiveKey.argument.type === "VIdentifier") return directiveKey.argument.rawName;
648
+ return null;
649
+ }
650
+ function resolveCallee(node) {
651
+ if (node.type === "CallExpression" || node.type === "NewExpression") return node.callee;
652
+ if (node.type === "TaggedTemplateExpression") return node.tag;
653
+ return node;
654
+ }
655
+ //#endregion
656
+ //#region src/plugin/i18next/index.ts
657
+ const i18next = {
658
+ meta: {
659
+ name: "i18next",
660
+ version: "1.0.0"
661
+ },
662
+ rules: { "no-literal-string": {
663
+ meta: {
664
+ type: "suggestion",
665
+ docs: {
666
+ description: "disallow literal string",
667
+ recommended: true
668
+ },
669
+ schema: [schema],
670
+ messages: { literal: "{{message}}: {{parent}}" }
671
+ },
672
+ create(context) {
673
+ const parserServices = context.parserServices ?? context.sourceCode?.parserServices;
674
+ const userOptions = context.options[0] ?? {};
675
+ const options = {
676
+ ...defaults,
677
+ ...userOptions
678
+ };
679
+ const { mode: rawMode, "should-validate-template": validateTemplate, message, framework: rawFramework } = options;
680
+ const mode = rawMode;
681
+ const framework = rawFramework;
682
+ const onlyValidateJSX = ["jsx-only", "jsx-text-only"].includes(mode);
683
+ const onlyValidateVueTemplate = framework === "vue" && mode === "vue-template-only";
684
+ const indicatorStack = [];
685
+ function endIndicator() {
686
+ indicatorStack.pop();
687
+ }
688
+ function isValidScope() {
689
+ return indicatorStack.some((item) => item);
690
+ }
691
+ function report(node) {
692
+ context.report({
693
+ node,
694
+ messageId: "literal",
695
+ data: {
696
+ message,
697
+ parent: getText(context, node.parent ?? node)
698
+ }
699
+ });
700
+ }
701
+ const { esTreeNodeToTSNodeMap, program } = parserServices ?? {};
702
+ let typeChecker;
703
+ if (program && esTreeNodeToTSNodeMap) typeChecker = program.getTypeChecker();
704
+ function validateBeforeReport(node) {
705
+ if (isValidScope()) return;
706
+ if (isValidLiteral(options, node)) return;
707
+ if (typeChecker) {
708
+ const tsNode = esTreeNodeToTSNodeMap?.get(node);
709
+ if (tsNode) {
710
+ const typeObj = typeChecker.getContextualType(tsNode);
711
+ if (typeObj) {
712
+ if (typeObj.isStringLiteral()) return;
713
+ if (typeObj.isUnion()) {
714
+ if (typeObj.types.some((item) => item.isStringLiteral() && item.value === node.value)) return;
715
+ }
716
+ }
717
+ }
718
+ }
719
+ report(node);
720
+ }
721
+ function filterOutJSX(node) {
722
+ if (!onlyValidateJSX) return false;
723
+ if (!getAncestors(context, node).some((item) => ["JSXElement", "JSXFragment"].includes(item.type))) return true;
724
+ if (mode === "jsx-text-only" && !["JSXElement", "JSXFragment"].includes(node.parent?.type ?? "")) return true;
725
+ return false;
726
+ }
727
+ const scriptVisitor = {
728
+ ImportExpression() {
729
+ indicatorStack.push(true);
730
+ },
731
+ "ImportExpression:exit": endIndicator,
732
+ ImportDeclaration() {
733
+ indicatorStack.push(true);
734
+ },
735
+ "ImportDeclaration:exit": endIndicator,
736
+ ExportAllDeclaration() {
737
+ indicatorStack.push(true);
738
+ },
739
+ "ExportAllDeclaration:exit": endIndicator,
740
+ "ExportNamedDeclaration[source]"() {
741
+ indicatorStack.push(true);
742
+ },
743
+ "ExportNamedDeclaration[source]:exit": endIndicator,
744
+ JSXElement(node) {
745
+ const fullComponentName = getText(context, node.openingElement.name);
746
+ const componentOptions = options["jsx-components"] ?? {};
747
+ indicatorStack.push(shouldSkip({
748
+ include: withDottedPrefix(componentOptions.include),
749
+ exclude: withDottedPrefix(componentOptions.exclude)
750
+ }, fullComponentName));
751
+ },
752
+ "JSXElement:exit": endIndicator,
753
+ JSXAttribute(node) {
754
+ const attrName = node.name.name;
755
+ if (shouldSkip(options["jsx-attributes"] ?? {}, attrName)) {
756
+ indicatorStack.push(true);
757
+ return;
758
+ }
759
+ const tagName = getNearestAncestor(node, "JSXOpeningElement").name.name;
760
+ if (isAllowedDOMAttr(tagName, attrName)) {
761
+ indicatorStack.push(true);
762
+ return;
763
+ }
764
+ indicatorStack.push(false);
765
+ },
766
+ "JSXAttribute:exit": endIndicator,
767
+ JSXText(node) {
768
+ validateBeforeReport(node);
769
+ },
770
+ VElement(node) {
771
+ const element = node;
772
+ const componentOptions = options["jsx-components"] ?? {};
773
+ indicatorStack.push(shouldSkip({
774
+ include: withDottedPrefix(componentOptions.include),
775
+ exclude: withDottedPrefix(componentOptions.exclude)
776
+ }, element.rawName));
777
+ },
778
+ "VElement:exit": endIndicator,
779
+ VAttribute(node) {
780
+ const attrName = getAttributeName(node);
781
+ const jsxAttributes = options["jsx-attributes"] ?? {};
782
+ indicatorStack.push(shouldSkip(jsxAttributes, attrName ?? ""));
783
+ },
784
+ "VAttribute:exit": endIndicator,
785
+ TSModuleDeclaration() {
786
+ indicatorStack.push(true);
787
+ },
788
+ "TSModuleDeclaration:exit": endIndicator,
789
+ TSLiteralType() {
790
+ indicatorStack.push(true);
791
+ },
792
+ "TSLiteralType:exit": endIndicator,
793
+ TSEnumMember() {
794
+ indicatorStack.push(true);
795
+ },
796
+ "TSEnumMember:exit": endIndicator,
797
+ PropertyDefinition(node) {
798
+ const property = node;
799
+ const classProperties = options["class-properties"] ?? {};
800
+ indicatorStack.push(!!(property.key.name && shouldSkip(classProperties, property.key.name)));
801
+ },
802
+ "PropertyDefinition:exit": endIndicator,
803
+ ClassProperty(node) {
804
+ const property = node;
805
+ const classProperties = options["class-properties"] ?? {};
806
+ indicatorStack.push(!!(property.key.name && shouldSkip(classProperties, property.key.name)));
807
+ },
808
+ "ClassProperty:exit": endIndicator,
809
+ VariableDeclarator(node) {
810
+ const declarator = node;
811
+ indicatorStack.push(declarator.id.type === "Identifier" && isUpperCase(declarator.id.name ?? ""));
812
+ },
813
+ "VariableDeclarator:exit": endIndicator,
814
+ Property(node) {
815
+ const property = node;
816
+ const objectProperties = options["object-properties"] ?? {};
817
+ indicatorStack.push(shouldSkip(objectProperties, property.key.name ?? property.key.value ?? ""));
818
+ },
819
+ "Property:exit": endIndicator,
820
+ BinaryExpression(node) {
821
+ const expression = node;
822
+ indicatorStack.push(expression.operator !== "+");
823
+ },
824
+ "BinaryExpression:exit": endIndicator,
825
+ AssignmentPattern() {
826
+ indicatorStack.push(true);
827
+ },
828
+ "AssignmentPattern:exit": endIndicator,
829
+ NewExpression(node) {
830
+ indicatorStack.push(isValidFunctionCall(context, options, { callee: resolveCallee(node) }));
831
+ },
832
+ "NewExpression:exit": endIndicator,
833
+ CallExpression(node) {
834
+ indicatorStack.push(isValidFunctionCall(context, options, { callee: resolveCallee(node) }));
835
+ },
836
+ "CallExpression:exit": endIndicator,
837
+ TaggedTemplateExpression(node) {
838
+ indicatorStack.push(isValidFunctionCall(context, options, { callee: resolveCallee(node) }));
839
+ },
840
+ "TaggedTemplateExpression:exit": endIndicator,
841
+ "AssignmentExpression[left.type=\"MemberExpression\"]"(node) {
842
+ const expression = node;
843
+ const objectProperties = options["object-properties"] ?? {};
844
+ indicatorStack.push(shouldSkip(objectProperties, expression.left.property.name ?? ""));
845
+ },
846
+ "AssignmentExpression[left.type=\"MemberExpression\"]:exit": endIndicator,
847
+ TemplateLiteral(node) {
848
+ if (!validateTemplate) return;
849
+ if (framework === "react" && filterOutJSX(node)) return;
850
+ if (isValidScope()) return;
851
+ node.quasis.some(({ value: { raw } }) => {
852
+ if (isValidLiteral(options, { value: raw })) return false;
853
+ report(node);
854
+ return true;
855
+ });
856
+ },
857
+ Literal(node) {
858
+ const literal = node;
859
+ if (["MemberExpression", "SwitchCase"].includes(literal.parent.type)) return;
860
+ if (framework === "react" && filterOutJSX(node)) return;
861
+ if (onlyValidateVueTemplate) {
862
+ const parents = getAncestors(context, node);
863
+ if (parents.length && parents.every((item) => ![
864
+ "VElement",
865
+ "VAttribute",
866
+ "VText",
867
+ "VExpressionContainer"
868
+ ].includes(item.type))) return;
869
+ }
870
+ if (literal.parent.key === node) return;
871
+ validateBeforeReport(node);
872
+ }
873
+ };
874
+ const defineTemplateBodyVisitor = parserServices?.defineTemplateBodyVisitor;
875
+ if (defineTemplateBodyVisitor) {
876
+ const invoke = (name) => (node) => {
877
+ const handler = scriptVisitor[name];
878
+ handler?.(node);
879
+ };
880
+ return defineTemplateBodyVisitor({
881
+ VText: invoke("JSXText"),
882
+ VLiteral: invoke("JSXText"),
883
+ VElement: invoke("VElement"),
884
+ "VElement:exit": invoke("VElement:exit"),
885
+ VAttribute: invoke("VAttribute"),
886
+ "VAttribute:exit": invoke("VAttribute:exit"),
887
+ "VExpressionContainer CallExpression": invoke("CallExpression"),
888
+ "VExpressionContainer CallExpression:exit": invoke("CallExpression:exit"),
889
+ "VExpressionContainer Literal": invoke("Literal")
890
+ }, scriptVisitor);
891
+ }
892
+ return scriptVisitor;
893
+ }
894
+ } }
895
+ };
896
+ //#endregion
897
+ export { i18next as default };
898
+
899
+ //# sourceMappingURL=i18next.mjs.map