@nkzw/eslint-plugin-fbtee 1.7.5 → 1.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.
package/README.md CHANGED
@@ -43,14 +43,74 @@ Sometimes it's easiest to learn by example and copy-paste the setup from existin
43
43
  npm install fbtee
44
44
  ```
45
45
 
46
- In addition to `fbtee`, you need to install the Babel preset.
46
+ In addition to `fbtee`, you need to install the compiler integration for your build tool. For Babel-based builds, install the Babel preset. This keeps the existing `fbtee` CLI commands available through the Babel tooling package:
47
47
 
48
48
  ```bash
49
49
  npm install -D @nkzw/babel-preset-fbtee
50
50
  ```
51
51
 
52
+ For SWC or Turbopack builds, install the SWC plugin and the standalone CLI package:
53
+
54
+ ```bash
55
+ npm install -D @nkzw/swc-plugin-fbtee @nkzw/fbtee-cli
56
+ ```
57
+
52
58
  ### Tooling Setup
53
59
 
60
+ #### Using **fbtee** with SWC or Turbopack
61
+
62
+ Use the SWC plugin when your build pipeline runs through SWC instead of Babel, such as Turbopack. Phrase extraction still uses `fbtee collect`; install `@nkzw/fbtee-cli` for SWC-only projects that do not install the Babel preset. The SWC plugin is the runtime compiler that lowers `fbt` and `<fbt>` callsites during application builds.
63
+
64
+ For raw SWC configuration:
65
+
66
+ ```json
67
+ {
68
+ "jsc": {
69
+ "experimental": {
70
+ "plugins": [
71
+ [
72
+ "@nkzw/swc-plugin-fbtee",
73
+ {
74
+ "fbtCommon": {
75
+ "Accept": "Button/Link: Accept conditions"
76
+ },
77
+ "fbtEnumManifest": {}
78
+ }
79
+ ]
80
+ ]
81
+ },
82
+ "parser": {
83
+ "syntax": "typescript",
84
+ "tsx": true
85
+ }
86
+ }
87
+ }
88
+ ```
89
+
90
+ For Next.js SWC plugins:
91
+
92
+ ```js
93
+ export default {
94
+ experimental: {
95
+ swcPlugins: [
96
+ [
97
+ '@nkzw/swc-plugin-fbtee',
98
+ {
99
+ fbtCommon: {
100
+ Accept: 'Button/Link: Accept conditions',
101
+ },
102
+ fbtEnumManifest: {},
103
+ },
104
+ ],
105
+ ],
106
+ },
107
+ };
108
+ ```
109
+
110
+ Do not pass `collectFbt: true` to the SWC plugin. Use `fbtee collect` for extraction and the SWC plugin for compiling app code.
111
+
112
+ #### Using **fbtee** with Vite
113
+
54
114
  If you are using Vite, install the React plugin for Vite:
55
115
 
56
116
  ```bash
@@ -94,7 +154,7 @@ export default defineConfig({
94
154
  });
95
155
  ```
96
156
 
97
- #### Using **fbtee** with Next.js
157
+ #### Using **fbtee** with Next.js and Babel
98
158
 
99
159
  Create a `babel.config.js` file in the root of your Next.js project and add the **fbtee** preset:
100
160
 
@@ -338,7 +398,7 @@ const Greeting = () => (
338
398
  // Example Output: "Alice, Bob and Charlie won the game against 2 bots on the map Forest Battle."
339
399
  ```
340
400
 
341
- _Note: `<fbt>` is auto-imported for you by the `@nkzw/babel-preset-fbtee` plugin._
401
+ _Note: `<fbt>` is auto-imported for you by the fbtee compiler integration._
342
402
 
343
403
  This example highlights several features of **fbtee**:
344
404
 
@@ -451,7 +511,7 @@ After marking your strings for translation with `<fbt>`, run the following comma
451
511
  pnpm fbtee collect
452
512
  ```
453
513
 
454
- You can now upload the `source_strings.json` file to your translation provider, for example [Crowdin](https://crowdin.com/). If you'd like to manually edit the strings, you can use the `fbtee prepare-translations --locales de_DE` to generate a JSON file that can be edited directly.
514
+ You can now upload the `source_strings.json` file to your translation provider, for example [Crowdin](https://crowdin.com/). If you'd like to manually edit the strings, you can use the `fbtee prepare-translations --locales de_DE` to generate a JSON file that can be edited directly. Pass `--sort-by-hash` to keep entries in a deterministic order for cleaner diffs when the file is committed.
455
515
 
456
516
  #### Generated File Structure
457
517
 
package/lib/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ESLintUtils } from "@typescript-eslint/utils";
2
2
  //#region package.json
3
3
  var name = "@nkzw/eslint-plugin-fbtee";
4
- var version = "1.7.4";
4
+ var version = "1.8.0";
5
5
  //#endregion
6
6
  //#region src/utils.tsx
7
7
  const createRule = ESLintUtils.RuleCreator((name) => `https://github.com/nkzw-tech/fbtee/blob/main/packages/eslint-plugin-fbtee/docs/rules/${name}.md`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nkzw/eslint-plugin-fbtee",
3
- "version": "1.7.5",
3
+ "version": "1.8.0",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "repository": {