Tell us about your environment
What parser (default, Babel-ESLint, etc.) are you using?
default
Please show your configuration:
no-useless-concat: "error",
prefer-template: "error",
What did you do? Please include the actual source code causing the issue.
Let's assume I have a legacy code:
const privateKey =
'-----BEGIN EC PRIVATE KEY-----\n' +
'MHcCAQEEIF+jnWY1D5kbVYDNvxxo/Y+ku2uJPDwS0r/VuPZQrjjVoAoGCCqGSM49\n' +
'AwEHoUQDQgAEurOxfSxmqIRYzJVagdZfMMSjRNNhB8i3mXyIMq704m2m52FdfKZ2\n' +
'pQhByd5eyj3lgZ7m7jbchtdgyOF8Io/1ng==\n' +
'-----END EC PRIVATE KEY-----\n';
What did you expect to happen?
A message proposing multiline template string, so I could replace it by:
const privateKey =
`-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIF+jnWY1D5kbVYDNvxxo/Y+ku2uJPDwS0r/VuPZQrjjVoAoGCCqGSM49
AwEHoUQDQgAEurOxfSxmqIRYzJVagdZfMMSjRNNhB8i3mXyIMq704m2m52FdfKZ2
pQhByd5eyj3lgZ7m7jbchtdgyOF8Io/1ng==
-----END EC PRIVATE KEY-----`;
What actually happened? Please include the actual, raw output from ESLint.
No reports.
I'd say no-useless-concat
would be the rule where this should happen, but it looks like it intentionally allows useless concatenation when it's multi-line.
I would be open to seeing a new option in that rule which would report even multi-line strings. Maybe an object option like { "reportMultiLineStrings": true }
or something like that. If that enhancement seems reasonable to you, would you mind filling out the rule change proposal template? Then we can evaluate the proposal :smile:
@platinumazure Done.
Thanks! I'm going to go ahead and close this issue since it's been superseded by the new one.