0.0.2 • Published 3 years ago
prettier-plugin-x-babel v0.0.2
prettier-plugin-x-babel
A fork of prettier-plugin-x
which uses
Babel and prettierX
by default for ES languages JavaScript, Flow, and TypeScript, all in a
Prettier plugin.
Includes options from prettierX for improved parity with "Standard JS", for example:
function * a () {}
console.log(typeof a)
with the following .prettierrc
configuration:
{
semi: false,
generatorStarSpacing: true,
spaceBeforeFunctionParen: true
}
Installation
with Yarn (recommended):
yarn add --dev prettier-plugin-x-babel
or with npm:
npm install --save-dev prettier-plugin-x-babel
Sample usage
prettier --config ./sample-prettierx-prettierrc --check sample.js
to specify TypeScript via babel-ts
parser:
prettier --config ./sample-prettierx-prettierrc --parser=typescript --check sample.js
or:
prettier --config ./sample-prettierx-prettierrc --parser=babel-ts --check sample.js
to specify Flow via babel-flow
parser:
prettier --config ./sample-prettierx-prettierrc --parser=flow --check sample.js
or:
prettier --config ./sample-prettierx-prettierrc --parser=babel-flow --check sample.js
Thanks and credits
- Based on:
prettier-plugin-x
- Thanks to https://github.com/prettier/plugin-php for an easy-to-understand Prettier plugin, which helped with the initial structure of this Prettier plugin.