@nkzw/eslint-plugin-fbtee 1.7.1 → 1.7.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/README.md CHANGED
@@ -114,7 +114,8 @@ export default {
114
114
  By default, **fbtee** expects your source code to be anywhere within your project, your translations in a `translations` folder, and the generated translations in `src/translations`. You can customize these paths using command line arguments:
115
115
 
116
116
  - The `--translations` parameter can be specified to `fbtee translate` to customize the path to the input translation files.
117
- - `--output-dir` can be specified to define where the output translations should be written so they can be loaded in your app. You can also use `--out` parameter to output a single file such as `translations.json`, which can be used directly in your app without loading individual translation files.
117
+ - The `--output-dir` parameter defines where the output translation files per language should be written (one file per locale), so they can be lazy loaded in your app.
118
+ - The `--output-file` parameter outputs all translations in a single combined file, which can be used directly in your app without loading individual files.
118
119
 
119
120
  If you want to use different paths, it is recommended to define custom commands in your `package.json`:
120
121
 
package/lib/index.d.mts CHANGED
@@ -22,11 +22,17 @@ declare const _default: {
22
22
  version: string;
23
23
  };
24
24
  rules: {
25
- 'no-empty-strings': _typescript_eslint_utils_ts_eslint0.RuleModule<"emptyString" | "jsxEmptyString", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
26
- 'no-unhelpful-desc': _typescript_eslint_utils_ts_eslint0.RuleModule<"emptyDesc" | "jsxEmptyDesc" | "duplicateDesc" | "shortDesc", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
25
+ 'no-empty-strings': _typescript_eslint_utils_ts_eslint0.RuleModule<"emptyString" | "jsxEmptyString", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener> & {
26
+ name: string;
27
+ };
28
+ 'no-unhelpful-desc': _typescript_eslint_utils_ts_eslint0.RuleModule<"emptyDesc" | "jsxEmptyDesc" | "duplicateDesc" | "shortDesc", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener> & {
29
+ name: string;
30
+ };
27
31
  'no-untranslated-strings': _typescript_eslint_utils_ts_eslint0.RuleModule<"unwrappedString", [{
28
32
  ignoredWords: Array<string>;
29
- }], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
33
+ }], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener> & {
34
+ name: string;
35
+ };
30
36
  };
31
37
  };
32
38
  //#endregion
package/lib/index.mjs CHANGED
@@ -1,26 +1,24 @@
1
1
  import { ESLintUtils } from "@typescript-eslint/utils";
2
-
3
2
  //#region package.json
4
3
  var name = "@nkzw/eslint-plugin-fbtee";
5
- var version = "1.7.0";
6
-
4
+ var version = "1.7.3";
7
5
  //#endregion
8
6
  //#region src/utils.tsx
9
- const createRule = ESLintUtils.RuleCreator((name$1) => `https://github.com/nkzw-tech/fbtee/blob/main/packages/eslint-plugin-fbtee/docs/rules/${name$1}.md`);
7
+ const createRule = ESLintUtils.RuleCreator((name) => `https://github.com/nkzw-tech/fbtee/blob/main/packages/eslint-plugin-fbtee/docs/rules/${name}.md`);
10
8
  function resolveMemberExpressions(object, property) {
11
9
  if (object.type === "JSXMemberExpression") return `${resolveMemberExpressions(object.object, object.property)}.${property.name}`;
12
10
  return `${object.name}.${property.name}`;
13
11
  }
14
12
  function elementType(node) {
15
13
  if (node.type === "JSXFragment") return "<>";
16
- const { name: name$1 } = node.openingElement;
17
- switch (name$1.type) {
18
- case "JSXIdentifier": return name$1.name;
14
+ const { name } = node.openingElement;
15
+ switch (name.type) {
16
+ case "JSXIdentifier": return name.name;
19
17
  case "JSXMemberExpression": {
20
- const { object, property } = name$1;
18
+ const { object, property } = name;
21
19
  return resolveMemberExpressions(object, property);
22
20
  }
23
- case "JSXNamespacedName": return `${name$1.namespace.name}:${name$1.name.name}`;
21
+ case "JSXNamespacedName": return `${name.namespace.name}:${name.name.name}`;
24
22
  default: throw new Error("Unsupported JSX node type.");
25
23
  }
26
24
  }
@@ -70,20 +68,19 @@ function hasFbtParent(node) {
70
68
  function isFbtNode(node) {
71
69
  if (!node) return null;
72
70
  if (node.type === "JSXElement") {
73
- const name$1 = elementType(node);
74
- return name$1 === "fbt" || name$1 === "fbs" || name$1?.startsWith("fbt:");
71
+ const name = elementType(node);
72
+ return name === "fbt" || name === "fbs" || name?.startsWith("fbt:");
75
73
  }
76
74
  if (node.type === "CallExpression" && node.callee.type === "Identifier") {
77
- const name$1 = node.callee.name;
78
- return name$1 === "fbt" || name$1 === "fbs";
75
+ const name = node.callee.name;
76
+ return name === "fbt" || name === "fbs";
79
77
  }
80
78
  if (node.type === "MemberExpression" && node.object.type === "CallExpression" && node.object.callee.type === "Identifier") {
81
- const name$1 = node.object.callee.name;
82
- return name$1 === "fbt" || name$1 === "fbs";
79
+ const name = node.object.callee.name;
80
+ return name === "fbt" || name === "fbs";
83
81
  }
84
82
  return false;
85
83
  }
86
-
87
84
  //#endregion
88
85
  //#region src/rules/no-empty-strings.tsx
89
86
  var no_empty_strings_default = createRule({
@@ -146,7 +143,6 @@ function validateChildren(node) {
146
143
  function isEmptyString(node) {
147
144
  return resolveNodeValue(node)?.trim() === "";
148
145
  }
149
-
150
146
  //#endregion
151
147
  //#region src/rules/no-unhelpful-desc.tsx
152
148
  var no_unhelpful_desc_default = createRule({
@@ -217,7 +213,6 @@ var no_unhelpful_desc_default = createRule({
217
213
  },
218
214
  name: "no-unhelpful-desc"
219
215
  });
220
-
221
216
  //#endregion
222
217
  //#region src/rules/no-untranslated-strings.tsx
223
218
  const attributes = new Set([
@@ -297,7 +292,6 @@ var no_untranslated_strings_default = createRule({
297
292
  },
298
293
  name: "no-untranslated-strings"
299
294
  });
300
-
301
295
  //#endregion
302
296
  //#region src/index.tsx
303
297
  var src_default = {
@@ -322,6 +316,5 @@ var src_default = {
322
316
  "no-untranslated-strings": no_untranslated_strings_default
323
317
  }
324
318
  };
325
-
326
319
  //#endregion
327
- export { src_default as default };
320
+ export { src_default as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nkzw/eslint-plugin-fbtee",
3
- "version": "1.7.1",
3
+ "version": "1.7.3",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "repository": {
@@ -15,10 +15,10 @@
15
15
  },
16
16
  "main": "lib/index.mjs",
17
17
  "dependencies": {
18
- "@typescript-eslint/utils": "^8.46.3"
18
+ "@typescript-eslint/utils": "^8.56.1"
19
19
  },
20
20
  "devDependencies": {
21
- "@typescript-eslint/rule-tester": "^8.46.3"
21
+ "@typescript-eslint/rule-tester": "^8.56.1"
22
22
  },
23
23
  "scripts": {
24
24
  "build": "tsdown src/index.tsx -d lib --target=node22 --format=esm --clean --dts"