Skip to content

resolritter/prettier-plugin-compactify

Repository files navigation

prettier-plugin-compactify

Available on npm as prettier-plugin-compactify

Introduction

This plugin collapses objects' formatting before passing the code to Prettier.

Effectively it preprocesses the code such that:

const obj = {
  foo: "bar"
}

Becomes:

const obj = {foo: "bar"
}

Which prettier will try to fit in a single line:

const obj = { foo: "bar" }

This plugin was created because Prettier keeps arbitrary newlines after a { even if the user does not want them. For more context see issue 10757.

Development

  1. Install pre-commit
  2. Install pre-commit hooks
  3. cd to this repository
  4. Run pre-commit install

Additionally:

  • yarn fix for formatting
  • yarn lint for linting

Release

yarn release

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages