Skip to content

Commit

Permalink
refactor(macro)!: remove arg macro (#1581)
Browse files Browse the repository at this point in the history
  • Loading branch information
timofei-iatsenko authored Apr 5, 2023
1 parent e4c0002 commit defda77
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 39 deletions.
14 changes: 0 additions & 14 deletions packages/macro/src/macroJs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,13 +367,6 @@ export default class MacroJs {
}

tokenizeExpression(node: Node | Expression): ArgToken {
if (this.isArg(node) && this.types.isCallExpression(node)) {
return {
type: "arg",
name: (node.arguments[0] as StringLiteral).value,
value: undefined,
}
}
return {
type: "arg",
name: this.expressionToArgument(node as Expression),
Expand Down Expand Up @@ -477,13 +470,6 @@ export default class MacroJs {
)
}

isArg(node: Node) {
return (
this.types.isCallExpression(node) &&
this.isLinguiIdentifier(node.callee, "arg")
)
}

isI18nMethod(node: Node) {
return (
this.types.isTaggedTemplateExpression(node) &&
Expand Down
1 change: 0 additions & 1 deletion packages/macro/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export type TestCase = {
}

const testCases: Record<string, TestCase[]> = {
"js-arg": require("./js-arg").default,
"js-t": require("./js-t").default,
"js-plural": require("./js-plural").default,
"js-select": require("./js-select").default,
Expand Down
23 changes: 0 additions & 23 deletions packages/macro/test/js-arg.ts

This file was deleted.

5 changes: 4 additions & 1 deletion packages/macro/test/js-defineMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,16 @@ const cases: TestCase[] = [
import { defineMessage, plural, arg } from '@lingui/macro';
const message = defineMessage({
comment: "Description",
message: plural(arg("value"), { one: "book", other: "books" })
message: plural(value, { one: "book", other: "books" })
})
`,
expected: `
const message =
/*i18n*/
{
values: {
value: value,
},
message: "{value, plural, one {book} other {books}}",
id: "SlmyxX",
comment: "Description",
Expand Down

0 comments on commit defda77

Please sign in to comment.