Skip to content

Commit

Permalink
chore: clean unusued additional function/component name code (#17)
Browse files Browse the repository at this point in the history
We don't use this code anymore because we just look for defaultMessage now
  • Loading branch information
Paul Salvatore authored Feb 5, 2024
1 parent 598c039 commit 464e35d
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 21 deletions.
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,6 @@ Ex.
}
```

#### additionalFunctionNames (Optional)

Similar to [@formatjs/ts-transformer](https://formatjs.io/docs/tooling/ts-transformer#additionalfunctionnames), this allows you to specify additional function names to check besides `formatMessage`.

#### additionalComponentNames (Optional)

Similar to [@formatjs/ts-transformer](https://formatjs.io/docs/tooling/ts-transformer#additionalcomponentnames), this allows you to specify additional component names to check besides `FormatMessage`.

#### onUndefinedMessage (Optional)

Callback function for when an string ID is encountered without a corresponding entry in the translatedMessages object. In this scenario the plugin falls back to the source language.
Expand Down
8 changes: 0 additions & 8 deletions src/__tests__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ describe("babel-plugin-formatjs-localized-bundle", () => {
"normal",
"mockMessages.js"
)),
additionalComponentNames: ["LocalMsg"],
additionalFunctionNames: ["localize"],
},
],
],
Expand Down Expand Up @@ -75,8 +73,6 @@ describe("babel-plugin-formatjs-localized-bundle", () => {
"normal",
"mockMessages.js"
),
additionalComponentNames: ["LocalMsg"],
additionalFunctionNames: ["localize"],
},
],
],
Expand Down Expand Up @@ -139,8 +135,6 @@ describe("babel-plugin-formatjs-localized-bundle", () => {
"pre-compiled",
"mockMessages.js"
)),
additionalComponentNames: ["LocalMsg"],
additionalFunctionNames: ["localize"],
},
],
],
Expand Down Expand Up @@ -279,8 +273,6 @@ describe("babel-plugin-formatjs-localized-bundle", () => {
"pre-compiled-nextjs",
"mockMessages.js"
)),
additionalComponentNames: ["LocalMsg"],
additionalFunctionNames: ["localize"],
},
],
],
Expand Down
5 changes: 0 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ module.exports = (babel, options) => {
return {};
}

const additionalFunctionName = options.additionalFunctionNames || [];
const additionalComponentNames = options.additionalComponentNames || [];
const functionNames = ["formatMessage", ...additionalFunctionName];
const componentNames = ["FormattedMessage", ...additionalComponentNames];

// Messages are expected to be an object of form {[id: string]: string | AST}
// translatedMessages can either be an object or a path to an object
const messages =
Expand Down

0 comments on commit 464e35d

Please sign in to comment.