Two quoted strings on one line are glued with +
What it finds
"Hello, " + "world" on one line: two string literals joined with + are one string split for no reason. Splitting a long string over several lines is fine and left alone.
The fix joins the two literals into one with the quotes of the first, when neither contains that quote or a backslash; it is safe.
From the rule's source, glued_quoted_strings.rs.
const greeting = "Hello, " + "world";tx0 reports: these two string literals can be written as oneconst label = name + " (" + "draft)";tx0 reports: these two string literals can be written as oneconst long = "first part " + "second part";declare const name: string; Turn it on, off or suppress it
The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/ts:glued-quoted-strings" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/ts:glued-quoted-strings] reason="..."tx0 explain tx0/ts:glued-quoted-strings shows the same in the terminal. Found a false positive? Report it.