简体   繁体   中英

React Prettier auto fix

React JSX

<Hello><Hello/>

to

<Hello/>

How can I fix code with prettier when I save code on VS code? Which setting should I edit?

install eslint-plugin-react . For reference please check below link

https://github.com/yannickcr/eslint-plugin-react

Hope this will help you.

If you are using the Prettier plugin in VS Code, do this:

  • Open the user settings - CTRL + ,
  • Search "Format on Save" and turn it on

This will use the formatter, in this case prettier, to format your code whenever you save.

This has nothing to do with Eslint plugin as other people are saying.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM