@nkzw/eslint-plugin-fbtee 1.7.4 → 1.7.6
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
|
@@ -451,7 +451,7 @@ After marking your strings for translation with `<fbt>`, run the following comma
|
|
|
451
451
|
pnpm fbtee collect
|
|
452
452
|
```
|
|
453
453
|
|
|
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.
|
|
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. Pass `--sort-by-hash` to keep entries in a deterministic order for cleaner diffs when the file is committed.
|
|
455
455
|
|
|
456
456
|
#### Generated File Structure
|
|
457
457
|
|
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
|
+
var version = "1.7.6";
|
|
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`);
|
|
@@ -230,7 +230,7 @@ const shouldIgnoreParent = (node) => {
|
|
|
230
230
|
};
|
|
231
231
|
var no_untranslated_strings_default = createRule({
|
|
232
232
|
create(context, options) {
|
|
233
|
-
const ignoredWords = new Set(options[0].ignoredWords.map((value) => value.
|
|
233
|
+
const ignoredWords = new Set(options[0].ignoredWords.map((value) => value.toLowerCase()));
|
|
234
234
|
const isIgnoredWord = (value) => ignoredWords.has(value.replaceAll(/\s+/g, " ").toLowerCase());
|
|
235
235
|
return {
|
|
236
236
|
JSXAttribute(node) {
|
package/package.json
CHANGED
|
@@ -247,6 +247,26 @@ ruleTester.run('no-untranslated-strings', rule, {
|
|
|
247
247
|
},
|
|
248
248
|
],
|
|
249
249
|
},
|
|
250
|
+
{
|
|
251
|
+
code: `
|
|
252
|
+
<input placeholder=" " />
|
|
253
|
+
`,
|
|
254
|
+
options: [
|
|
255
|
+
{
|
|
256
|
+
ignoredWords: [' '],
|
|
257
|
+
},
|
|
258
|
+
],
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
code: `
|
|
262
|
+
<span>{' '}</span>
|
|
263
|
+
`,
|
|
264
|
+
options: [
|
|
265
|
+
{
|
|
266
|
+
ignoredWords: [' '],
|
|
267
|
+
},
|
|
268
|
+
],
|
|
269
|
+
},
|
|
250
270
|
{
|
|
251
271
|
code: `
|
|
252
272
|
<textarea rows={2}></textarea>
|
|
@@ -32,7 +32,7 @@ const shouldIgnoreParent = (node: TSESTree.Node) => {
|
|
|
32
32
|
export default createRule<Options, 'unwrappedString'>({
|
|
33
33
|
create(context, options) {
|
|
34
34
|
const ignoredWords = new Set(
|
|
35
|
-
options[0].ignoredWords.map((value) => value.
|
|
35
|
+
options[0].ignoredWords.map((value) => value.toLowerCase()),
|
|
36
36
|
);
|
|
37
37
|
|
|
38
38
|
const isIgnoredWord = (value: string) =>
|