function

Format code to unify the code style, usually in conjunction with ESLint

use

Install dependencies

npm install prettier
Copy the code

Configure [.prettierrc]

{printWidth:80,// editor each line length tabWidth:4,// TAB width, default is 2 useTabs:true,// whether to use TAB setting, default false semi:false,// whether to use semicolon [;] SinglQuote :true,// whether to use single quotes, Defaults to true bracketSpacing: true, / / object space between jsxBracketSameLine: true, / / rear JSX TAB > keep peer jsxSingleQuote 】 : true, / / jax attribute to use single quotation marks "EndOfLine" : "lf", / / at the end of line arrowParens said: "get", / / whether can use x = > x, or x (x) = >}Copy the code

other

eslint-config-prettier

lint-staged