Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: clean unusued additional function/component name code #17

Merged
merged 1 commit into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading