i18next-cli 1.42.2 → 1.42.3

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.
package/dist/cjs/cli.js CHANGED
@@ -28,7 +28,7 @@ const program = new commander.Command();
28
28
  program
29
29
  .name('i18next-cli')
30
30
  .description('A unified, high-performance i18next CLI.')
31
- .version('1.42.2'); // This string is replaced with the actual version at build time by rollup
31
+ .version('1.42.3'); // This string is replaced with the actual version at build time by rollup
32
32
  // new: global config override option
33
33
  program.option('-c, --config <path>', 'Path to i18next-cli config file (overrides detection)');
34
34
  program
@@ -119,8 +119,11 @@ function lintInterpolationParams(ast, code, config) {
119
119
  const issueLineNumber = position > -1 ? getLineNumber(position) : 1;
120
120
  // Only check for unused parameters if there is at least one interpolation key in the string
121
121
  if (keys.length > 0) {
122
+ // i18next supports nested object access via dot notation (e.g. {{author.name}} with { author }).
123
+ // For each interpolation key, check if the root (part before the first dot) matches a provided param.
122
124
  for (const k of keys) {
123
- if (!paramKeys.includes(k)) {
125
+ const root = k.split('.')[0];
126
+ if (!paramKeys.includes(k) && !paramKeys.includes(root)) {
124
127
  issues.push({
125
128
  text: `Interpolation parameter "${k}" was not provided`,
126
129
  line: issueLineNumber,
@@ -128,8 +131,10 @@ function lintInterpolationParams(ast, code, config) {
128
131
  });
129
132
  }
130
133
  }
134
+ // For each provided param, check if it is used either directly or as the root of a dotted key.
131
135
  for (const pk of paramKeys) {
132
- if (!keys.includes(pk)) {
136
+ const isUsed = keys.some(k => k === pk || k.split('.')[0] === pk);
137
+ if (!isUsed) {
133
138
  issues.push({
134
139
  text: `Parameter "${pk}" is not used in translation string`,
135
140
  line: issueLineNumber,
package/dist/esm/cli.js CHANGED
@@ -26,7 +26,7 @@ const program = new Command();
26
26
  program
27
27
  .name('i18next-cli')
28
28
  .description('A unified, high-performance i18next CLI.')
29
- .version('1.42.2'); // This string is replaced with the actual version at build time by rollup
29
+ .version('1.42.3'); // This string is replaced with the actual version at build time by rollup
30
30
  // new: global config override option
31
31
  program.option('-c, --config <path>', 'Path to i18next-cli config file (overrides detection)');
32
32
  program
@@ -117,8 +117,11 @@ function lintInterpolationParams(ast, code, config) {
117
117
  const issueLineNumber = position > -1 ? getLineNumber(position) : 1;
118
118
  // Only check for unused parameters if there is at least one interpolation key in the string
119
119
  if (keys.length > 0) {
120
+ // i18next supports nested object access via dot notation (e.g. {{author.name}} with { author }).
121
+ // For each interpolation key, check if the root (part before the first dot) matches a provided param.
120
122
  for (const k of keys) {
121
- if (!paramKeys.includes(k)) {
123
+ const root = k.split('.')[0];
124
+ if (!paramKeys.includes(k) && !paramKeys.includes(root)) {
122
125
  issues.push({
123
126
  text: `Interpolation parameter "${k}" was not provided`,
124
127
  line: issueLineNumber,
@@ -126,8 +129,10 @@ function lintInterpolationParams(ast, code, config) {
126
129
  });
127
130
  }
128
131
  }
132
+ // For each provided param, check if it is used either directly or as the root of a dotted key.
129
133
  for (const pk of paramKeys) {
130
- if (!keys.includes(pk)) {
134
+ const isUsed = keys.some(k => k === pk || k.split('.')[0] === pk);
135
+ if (!isUsed) {
131
136
  issues.push({
132
137
  text: `Parameter "${pk}" is not used in translation string`,
133
138
  line: issueLineNumber,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "i18next-cli",
3
- "version": "1.42.2",
3
+ "version": "1.42.3",
4
4
  "description": "A unified, high-performance i18next CLI.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1 +1 @@
1
- {"version":3,"file":"linter.d.ts","sourceRoot":"","sources":["../src/linter.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAI1C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAwI3D,KAAK,cAAc,GAAG;IACpB,QAAQ,EAAE;QAAC;YACT,OAAO,EAAE,MAAM,CAAC;SACjB;KAAC,CAAC;IACH,IAAI,EAAE;QAAC;YACL,OAA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