Skip to content
This repository was archived by the owner on Nov 20, 2020. It is now read-only.

Latest commit

 

History

History
85 lines (66 loc) · 2.16 KB

README.md

File metadata and controls

85 lines (66 loc) · 2.16 KB

DEPRECATED. Check @modyqyw/fabric.

@modyqyw/prettier-config

A prettier shareable config for JavaScript/TypeScript/CSS/LESS/SCSS.

Usage

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,
};

VSCode

  • Install plugins.
  • Set up Settings.json. Then F1 => 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.

More Configs

@modyqyw/eslint-config and @modyqyw/stylelint-config do not use any Prettier config and plugin, while @modyqyw/fabric does.

License

MIT

Copyright (c) 2020-present MillCloud