3.3.3 • Published 12 months ago

@btmills/prettier v3.3.3

Weekly downloads
623
License
MIT
Repository
github
Last release
12 months ago

:fork_and_knife: This is a fork.

Compared to prettier, @btmills/prettier moves binary operators to the beginning of new lines in long expressions instead of the end of the previous line. That's it.

// prettier:
const before =
  bom.length >= 2 &&
  ((bom.charCodeAt(0) === 0xff && bom.charCodeAt(1) === 0xfe) ||
    (bom.charCodeAt(0) === 0xfe && bom.charCodeAt(1) === 0xff));

// @btmills/prettier:
const after =
  bom.length >= 2
  && ((bom.charCodeAt(0) === 0xff && bom.charCodeAt(1) === 0xfe)
    || (bom.charCodeAt(0) === 0xfe && bom.charCodeAt(1) === 0xff));

Usage

Install using an alias (npm, yarn) so that require('prettier') transparently resolves to this fork:

npm install --save-dev prettier@npm:@btmills/prettier
yarn add --dev prettier@npm:@btmills/prettier

This package will function just like prettier, and editor integrations should use it as if it were the real thing.

Releases

Releases of the forked package are done by rebasing the line-before-operator branch on top of the most recent version tag in main.

# Get the latest changes and update the main branch:
git checkout main
git pull
git push fork

# Rebase the release branch on the latest version:
git checkout line-before-operator
git rebase x.y.z

# Fix conflicts as necessary.
git rebase --continue
# There will be a merge conflict in `yarn.lock`. To resolve it:
yarn && yarn dedupe && yarn dedupe --check
# If any conflicts in snapshots, discard and update automatically:
yarn test -u

# With rebasing done, run tests, push tags, build, and publish:
yarn run lint
yarn test
git tag x.y.z-fork
git push --force-with-lease
git push --tags
yarn run build
yarn run test:dist
cd dist
npm publish

Prettier Banner

Intro

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!


Documentation

Install · Options · CLI · API

Playground


Badge

Show the world you're using Prettiercode style: prettier

[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)

Contributing

See CONTRIBUTING.md.

3.3.1

12 months ago

3.3.0

12 months ago

3.3.3

12 months ago

3.3.2

12 months ago

3.2.5

1 year ago

3.2.2

1 year ago

3.2.1

1 year ago

3.2.4

1 year ago

3.2.3

1 year ago

3.2.0

1 year ago

3.1.1

1 year ago

3.1.0

2 years ago

3.0.3

2 years ago

3.0.2

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

2.8.8

2 years ago

2.8.1

2 years ago

2.8.0

2 years ago

2.8.3

2 years ago

2.8.2

2 years ago

2.8.5

2 years ago

2.8.4

2 years ago

2.8.7

2 years ago

2.8.6

2 years ago

2.7.0

3 years ago

2.7.1

3 years ago

2.6.1

3 years ago

2.6.0

3 years ago

2.6.2

3 years ago

2.5.0

3 years ago

2.4.1

3 years ago

2.3.2

3 years ago

2.4.0

3 years ago

2.5.1

3 years ago

2.3.0

4 years ago

2.3.1

4 years ago

2.2.1

5 years ago

2.2.0

5 years ago

2.1.2

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.5

5 years ago

2.0.4

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.19.0

6 years ago

1.19.1

6 years ago

1.18.2

6 years ago

1.18.1

6 years ago

1.18.0

6 years ago

1.17.1

6 years ago

1.17.0

6 years ago

1.16.4

6 years ago

1.16.3

6 years ago

1.16.2

6 years ago

1.16.1

6 years ago

1.16.0

6 years ago

1.15.3

7 years ago

1.15.2

7 years ago

1.15.1

7 years ago

1.15.0

7 years ago

1.14.3

7 years ago

1.14.3-rc.0

7 years ago