1 Star 0 Fork 2

InkBottle / Prettier

forked from Gitee 极速下载 / Prettier 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
CONTRIBUTING.md 1.60 KB
一键复制 编辑 原始数据 按行查看 历史

Contributing to Prettier

To get up and running, install the dependencies and run the tests:

yarn
yarn lint
yarn test

Here's what you need to know about the tests:

  • The tests uses Jest snapshots.
  • You can make changes and run jest -u (or yarn test -- -u) to update the snapshots. Then run git diff to take a look at what changed. Always update the snapshots when opening a PR.
  • You can run AST_COMPARE=1 jest for a more robust test run. That formats each file, re-parses it, and compares the new AST with the original one and makes sure they are semantically equivalent.
  • Each test folder has a jsfmt.spec.js that runs the tests. Normally you can just put run_spec(__dirname); there. You can also pass options and additional parsers, like this: run_spec(__dirname, { trailingComma: "es5" }, ["babylon"]);
  • tests/flow/ contains the Flow test suite, and is not supposed to be edited by hand. To update it, clone the Flow repo next to the Prettier repo and run: node scripts/sync-flow-tests.js ../flow/tests/.
  • If you would like to debug prettier locally, you can either debug it in node or the browser. The easiest way to debug it in the browser is to run the interactive docs REPL locally. The easiest way to debug it in node, is to create a local test file and run it in an editor like VS Code.

Run yarn lint -- --fix to automatically format files.

If you can, take look at commands.md and check out Wadler's paper to understand how Prettier works.

1
https://gitee.com/touchx/Prettier.git
git@gitee.com:touchx/Prettier.git
touchx
Prettier
Prettier
master

搜索帮助