Skip to content
This repository has been archived by the owner on Jul 29, 2020. It is now read-only.

Run Prettier, an opinionated code formatter, using Pronto.

License

Notifications You must be signed in to change notification settings

andrewmcodes-archive/pronto-prettier-npm

Repository files navigation

Pronto runner for Prettier using NPM

Build Status

Pronto runner for Prettier, an opinionated code formatter for JavaScript, JSX, and more.


Prerequisites

You'll need to install prettier by yourself with yarn/npm. If prettier is in your PATH, everything will simply work, otherwise you have to provide pronto-prettier-npm your custom executable path (see below).


Configuration of Prettier

Configure Prettier like you normally would.


Configuration of Pronto::Prettier::NPM

pronto-prettier-npm can be configured by placing a .pronto_prettier_npm.yml inside the directory where Pronto is run.

Following options are available:

Option Meaning Default
prettier_executable Prettier executable to call. prettier (calls prettier in PATH)
files_to_lint What files to lint. Absolute path of offending file will be matched against this Regexp. `(.js
cmd_line_opts Command line options to pass to prettier when running --check

Example configuration

Calls custom prettier executable and only lints files ending with .my_custom_extension:

# .pronto_prettier_npm.yml
prettier_executable: '/my/custom/node/path/.bin/prettier'
files_to_lint: '\.my_custom_extension$'
cmd_line_opts: '--ext .scss,.js,.jsx'

Installation

Add this line to your application's Gemfile:

gem 'pronto-prettier-npm'

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.


Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/andrewmcodes/pronto-prettier-npm. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.


License

The gem is available as open source under the terms of the MIT License.


Code of Conduct

Everyone interacting in the Pronto::Prettier::Npm project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.


Recognition

This project was originally forked from doits/pronto-eslint_npm. Many thanks to Markus Doits for creating this awesome project.

Releases

No releases published

Packages

No packages published