DEPRECATED. Check @modyqyw/fabric.
A prettier shareable config for JavaScript/TypeScript/CSS/LESS/SCSS.
npm i -D prettier@~2.1.2 @modyqyw/prettier-config@~1.1.9
# or
#yarn add -D prettier@~2.1.2 @modyqyw/prettier-config@~1.1.9
Set prettier
field in ${PROJECT_DIR}/package.json
.
{
...,
"prettier": "@modyqyw/prettier-config",
...
}
Or use ${PROJECT_DIR}/prettier.config.js
if you want to overwrite.
// ${PROJECT_DIR}/prettier.config.js
const config = require("@modyqyw/prettier-config");
module.exports = {
...config,
// write your own rules here
printWidth: 100,
};
- Install plugins.
- Set up
Settings.json
. ThenF1 => Format Document
=>F1 => File: Save
.
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"files.eol": "\n",
"files.associations": {
"*.wxml": "html",
"*.wxs": "javascript",
"*.wxss": "css",
"*.axml": "html",
"*.sjs": "javascript",
"*.acss": "css",
"*.swan": "html",
"*.ttml": "html",
"*.ttss": "css",
"*.jxml": "html",
"*.jxss": "css",
"*.wpy": "vue",
"*.nvue": "vue",
"*.ux": "vue"
},
"[vue]": {
"editor.defaultFormatter": "octref.vetur"
}
}
For auto formatting, use "editor.formatOnSave": true
.
@modyqyw/prettier-config
- Github Gitee@modyqyw/eslint-config
- Github Gitee@modyqyw/stylelint-config
- Github Gitee
@modyqyw/eslint-config
and @modyqyw/stylelint-config
do not use any Prettier
config and plugin, while @modyqyw/fabric
does.
Copyright (c) 2020-present MillCloud