Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prettier ask me to replace ⏎↹↹ with ·

I have no clue what's going on,

I cloned a github repo and literally just tried to change like one line but I got hit by this prettier error which makes no sense to me (I've never used prettier).

Replace ↹return·(⏎↹↹<img·alt='logo'·src='./Logo.png'·/>⏎↹); with ··return·<img·alt="logo"·src="./Logo.png"·/> prettier/prettier

Anything could be helpful at this point, I'm using MacOS and working on VSCode

like image 697
Pepe Avatar asked May 26 '21 09:05

Pepe


People also ask

What is ESLint plugin prettier?

Runs Prettier as an ESLint rule and reports differences as individual ESLint issues. If your desired formatting does not match Prettier's output, you should use a different tool such as prettier-eslint instead. Please read Integrating with linters before installing.

Do you need prettier with ESLint?

Benefits of using Prettier and ESLint As mentioned earlier, whereas Prettier takes care of your code formatting, ESLint takes care of your code style. The former does everything automatically for you. If you have set up Prettier, you can configure it to format your file on saving it.


3 Answers

I had the same issue, in the eslinrc.json file under "prettier/prettier", I removed printWidth.

like image 126
Xavier Maldonado Avatar answered Dec 31 '22 18:12

Xavier Maldonado


This is usally due to some configuration with eslint preventing you from making errors and introducing unwanted characters in your code. I fixed this by running one line eslint --fix . . Make sure you install eslint globally first npm i -g eslint .

like image 32
Tony Marfo O Avatar answered Dec 31 '22 19:12

Tony Marfo O


I think this is caused by Prettier being configured to use spaces instead of tabs to indent and then your code editor using tabs. So Prettier wants you to replace those tabs with spaces.

Alternatively, you can set your code editor to use tabs.

What worked for me was adding this to the rules object in .prettierrc:

{
  "useTabs": false
}
like image 23
Chukwualuka Chiama Avatar answered Dec 31 '22 18:12

Chukwualuka Chiama