no-unexpected-multiline and template literal with typescript
See original GitHub issueTell us about your environment
- eslint 6.9.0
- node v11.6.0
- npm 6.9.0
- typescript 3.3.4
What parser (default, Babel-ESLint, etc.) are you using?
Not sure. I use CRA 3 without ejecting.
Please show your full configuration:
Configuration
{
"extends": "react-app"
}
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
function myTag<T>(...args): any {
return undefined;
}
export const test = myTag<{
field: boolean;
}>`
test;
`;
The command:
eslint --ext js,ts,ts,tsx src
What did you expect to happen?
No eslint warnings will be raised
What actually happened? Please include the actual, raw output from ESLint.
./src/test.ts
Line 5: Unexpected newline between template tag and template literal no-unexpected-multiline
But with
function myTag<T>(...args): any {
return undefined;
}
export const test = myTag<{ field: boolean }>`
test;
`;
No warnings are showing.
It especially frustrates when you are using styled-components and component have a lot of props, that will not fit the maximum line length.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:11
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Wrap long template literal line to multiline without creating a ...
If you introduce a line continuation ( \ ) at the point of the newline in the literal, it won't create a newline...
Read more >Template literals (Template strings) - JavaScript | MDN
Template literals are literals delimited with backtick (`) characters, allowing for multi-line strings, string interpolation with embedded ...
Read more >no-unexpected-multiline - 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 >How to Create Multi-Line String with Template Literals
It's super easy now to create multi-line strings with Template Literals in JavaScript. No more messy string line breaks. Yay, ES6!
Read more >Prettier 2.2: new JavaScript parsers, TS 4.1 and ESM ...
Template Literal Types. // Input type HelloWorld = `Hello, ${keyof World}` // Prettier 2.1 SyntaxError: Unexpected token, ...
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 FreeTop 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
Top GitHub Comments
same issue, prettier will automatic format
to
which will cause eslint error, which is verify frustrating
Closing because there hasn’t been activity for a few days. If it still occurs, please file a new issue. thanks!