Check that translated messages doesn't contain patterns from the rules.
This rule enforces a consistency rules inside your messages.
rules
is array of rules when one rule has structure
{
"patterns": ["first", "second"],
"message": "error message"
}
each rule
has a structure:
patterns
is an array of regex or stringsmessage
is an error message that will be displayed if restricting pattern matches textflags
is a string with regex flags for patterns
Restrict specific quotes to be used in the messages:
{
"lingui/text-restrictions": [
"error",
{
"rules": [
{
"patterns": ["''", "’", "“"],
"message": "Quotes should be ' or \""
}
]
}
]
}
Example of invalid code with this rule:
t`Hello “mate“`
msg`Hello “mate“`
t({ message: `Hello “mate“` })
Example of valid code with this rule:
t`Hello "mate"`