Comment on page
Formatting and Linting
npm install --save-dev --save-exact prettier
npm install --global xo
Then add
xo
to your project with (note, installed globally so no npx
)xo --init
Within
package.json
add the following;package.json
{
"scripts": {
"format": "prettier --write '**/*.js' && xo --fix"
},
"prettier": {
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"bracketSpacing": false,
"semi": false,
"trailingComma": "none"
},
"xo": {
"prettier": true,
"esnext": false
}
}
Last modified 4yr ago