@sheeptester/prettier
v3.9.0
Published
Prettier is an opinionated code formatter
Readme
Fork of Prettier
This is a fork of Prettier to support StandardJS. As the years pass, prettier-standard and prettierX get increasingly out of date, and my formatters are unable to format new JavaScript/TypeScript syntax features like import attributes. And now the Prettier VS Code extension no longer accepts prettierX's version number.
The goal of this fork is to port the following four new config options from prettierX:
generatorStarSpacingspaceBeforeFunctionParenoffsetTernaryExpressionsyieldStarSpacing
With those extra options, the following config should satisfy most of StandardJS's formatting rules.
arrowParens: avoid
generatorStarSpacing: true
spaceBeforeFunctionParen: true
singleQuote: true
jsxSingleQuote: true
semi: false
offsetTernaryExpressions: true
yieldStarSpacing: true
trailingComma: noneUsage
Install my fork with
npm install -D @sheeptester/prettierThen put the above config in .prettierrc.yml.
The API should otherwise be identical to Prettier, so for example, npx prettier . --write will format all your files.
In VS Code, you can specify the Prettier instance you're using with
{
"prettier.prettierPath": "@sheeptester/prettier"
}Other IDEs probably have an equivalent setting.
Known differences
See the StandardJS test snapshot diff. Compared to prettierX,
- Top-level comma expressions are now wrapped in parentheses
;(a, b). - Long template literals now get wrapped.
Development
See CONTRIBUTING.md for how testing works.
yarn build
cd dist/prettier
# Add `--tag alpha` if publishing a prerelease version
npm publish --access publicIntro
Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary.
Input
foo(reallyLongArg(), omgSoManyParameters(), IShouldRefactorThis(), isThereSeriouslyAnotherOne());Output
foo(
reallyLongArg(),
omgSoManyParameters(),
IShouldRefactorThis(),
isThereSeriouslyAnotherOne(),
);Prettier can be run in your editor on-save, in a pre-commit hook, or in CI environments to ensure your codebase has a consistent style without devs ever having to post a nit-picky comment on a code review ever again!
Badge
Show the world you're using Prettier →
[](https://github.com/prettier/prettier)Contributing
See CONTRIBUTING.md.
