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: noneInstall 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": "./node_modules/@sheeptester/prettier/index.mjs"
}Other IDEs probably have an equivalent setting.
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.
See CONTRIBUTING.md for how testing works.
yarn build
cd dist/prettier
# Add `--tag alpha` if publishing a prerelease version
npm publish --access public
JavaScript
· TypeScript
· Flow
· JSX
· JSON
CSS
· SCSS
· Less
HTML
· Vue
· Angular
GraphQL
· Markdown
· YAML
Your favorite language?
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.
foo(reallyLongArg(), omgSoManyParameters(), IShouldRefactorThis(), isThereSeriouslyAnotherOne());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!
Show the world you're using Prettier →
[](https://github.com/prettier/prettier)See CONTRIBUTING.md.