Proposal for no-useless-concat to report multiline strings
See original GitHub issueWhat rule do you want to change?
no-useless-concat
Does this change cause the rule to produce more or fewer warnings? More.
How will the change be implemented? (New option, new default behavior, etc.)?
An object option like { "reportMultiLineStrings": true }
.
Please provide some example code that this change will affect:
const privateKey =
'-----BEGIN EC PRIVATE KEY-----\n' +
'MHcCAQEEIF+jnWY1D5kbVYDNvxxo/Y+ku2uJPDwS0r/VuPZQrjjVoAoGCCqGSM49\n' +
'AwEHoUQDQgAEurOxfSxmqIRYzJVagdZfMMSjRNNhB8i3mXyIMq704m2m52FdfKZ2\n' +
'pQhByd5eyj3lgZ7m7jbchtdgyOF8Io/1ng==\n' +
'-----END EC PRIVATE KEY-----\n';
What does the rule currently do for this code? No warning.
What will the rule do after it’s changed? Propose multiline template literal.
See also this comment.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:5
- Comments:6 (4 by maintainers)
Top Results From Across the Web
no-useless-concat - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >Java static code analysis: String multiline concatenation ...
Strings should not be concatenated using '+' in a loop ... The most common pattern for multiline strings in Java < 15 was...
Read more >Disallow unnecessary concatenation of strings (no-useless ...
Disallow unnecessary concatenation of strings (no-useless-concat). It's unnecessary to concatenate two strings together, such as: var foo = "a" + "b";.
Read more >Wrap long template literal line to multiline without creating a ...
The solution proposed by @CodingIntrigue is not working for me on node 7. Well, it works if I do not use a line...
Read more >How do I create a multiline string in JavaScript? - ReqBin
For readability, it was possible to split a long string into several lines and concatenate using the (+) operator. This approach is helpful...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Basically you want…
…to be written like…
The rule would be okay with this, correct?
It would search for two strings being concatenated on a line break with a new line character. I’m for it. I’d also be down for implementing it. It shouldn’t be a terribly difficult rule to apply.
Thanks for your interest in improving ESLint. Unfortunately, it looks like this issue didn’t get enough support from the team and so I’m closing it. While we wish we’d be able to accommodate everyone’s requests, we do need to prioritize. We’ve found that issues failing to reach consensus after a long time tend to never do it, and as such, we close those issues. This doesn’t mean the idea isn’t interesting, just that it’s not something the team can commit to.