Pronto runner for Prettier, an opinionated code formatter for JavaScript, JSX, and more.
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).
Configure Prettier like you normally would.
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 |
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'
Add this line to your application's Gemfile:
gem 'pronto-prettier-npm'
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.
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.
The gem is available as open source under the terms of the MIT License.
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.
This project was originally forked from doits/pronto-eslint_npm. Many thanks to Markus Doits for creating this awesome project.