no-unexpected-multiline rule clashes with Prettier
See original GitHub issueI am using TypeScript, Prettier (1.17.0) and styled-components
in a CRA app. When I define the prop types of my styled components inline, I end up with constructs like these:
const Component = styled.div<{
prop1?: Type;
prop2?: Type;
}>`
/* Some styles here... */
`;
The above is the formatting chosen by Prettier. However, CRA’s ESLint config doesn’t seem to agree:
Line 1: Unexpected newline between template tag and template literal no-unexpected-multiline [no-unexpected-multiline]
This means that when I use the pattern above, it is impossible for me to use ESLint and create-react-app together without getting linter errors. It would be cool if the no-unexpected-multiline
rule could be either disabled or configured to not trigger in the cases that Prettier creates.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:28
- Comments:5
Top Results From Across the Web
prettier conflicts with no-unexpected-multiline #32 - GitHub
This scenario is relevant when a shareable config like airbnb-base is combined with prettier. If the rule no-unexpected-multiline is enabled ...
Read more >Rationale - Prettier
Once an object literal becomes multiline, Prettier won't collapse it back. If in Prettier-formatted code, we add a property to an object literal,...
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 >eslint-config-prettier/README.md - UNPKG
Turns off all rules that are unnecessary or might conflict with [Prettier]. 4. 5, This lets you use you favorite shareable config without...
Read more >Why does it seem like eslint and prettier are fighting one ...
As I worked on this project, I had rules that I wanted to turn off; mainly eslint no-unexpected-multiline , prettier printWidth and some ......
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
this is crazy annoying, one kind of a workaround I found so far is replacing this
with this
I added this to my package.json (i’m using typescript)