Giter Club home page Giter Club logo

prettier-plugin-reasonml's Introduction

  Prettier     Elm  

Prettier ReasonML plugin

Wrapper plugin adding refmt support to Prettier. This brings *.re files support to Prettier and allows you to format those files like you would the rest of your codebase, while also inheriting the configured Prettier options. This follows the same model as the Elm plugin in that the code to format is passed directly to refmt and isn't transformed into an AST, the goal of this package is to simply integrate refmt more smoothly into your workflow if you already use Prettier.

Installation

npm install prettier prettier-plugin-reasonml -g # or
yarn global add prettier prettier-plugin-reasonml

Usage

All you need to do is use Prettier on ReasonML files like you would any other files:

prettier src/**/*.re --write --print-width 120

VSCode plugin support is currently blocked by this issue.

Using other refmt binaries

If refmt is not in your path or you wanted to use bsrefmt, set the environment variable REFMT_BIN

REFMT_BIN=bsrefmt prettier src/**/*.re --write --print-width 120

Credits

This is largly inspired by prettier-plugin-elm so props to them.

prettier-plugin-reasonml's People

Contributors

anahkiasen avatar russellmcc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

jibingeo

prettier-plugin-reasonml's Issues

try use this lib, but not working

I try instalation using yarn and npm but the erros is equals.
my config is:

  • Manjaro Arch Linux
  • nodejs v12.11.1

the message erros is:

src/Index.re
[error] src/Index.re: Error: spawnSync refmt ENOENT
[error]     at Object.spawnSync (internal/child_process.js:1041:20)
[error]     at Object.spawnSync (child_process.js:607:24)
[error]     at module.exports.sync (/home/enieber/.fnm/node-versions/v12.11.1/installation/lib/node_modules/prettier-plugin-reasonml/node_modules/execa/index.js:334:30)
[error]     at format (/home/enieber/.fnm/node-versions/v12.11.1/installation/lib/node_modules/prettier-plugin-reasonml/src/parse.js:4:5)
[error]     at Object.parse (/home/enieber/.fnm/node-versions/v12.11.1/installation/lib/node_modules/prettier-plugin-reasonml/src/parse.js:13:11)
[error]     at Object.parse (/home/enieber/.fnm/node-versions/v12.11.1/installation/lib/node_modules/prettier/bin-prettier.js:9743:19)
[error]     at coreFormat (/home/enieber/.fnm/node-versions/v12.11.1/installation/lib/node_modules/prettier/bin-prettier.js:13258:23)
[error]     at format (/home/enieber/.fnm/node-versions/v12.11.1/installation/lib/node_modules/prettier/bin-prettier.js:13516:73)
[error]     at formatWithCursor (/home/enieber/.fnm/node-versions/v12.11.1/installation/lib/node_modules/prettier/bin-prettier.js:13532:12)
[error]     at Object.formatWithCursor (/home/enieber/.fnm/node-versions/v12.11.1/installation/lib/node_modules/prettier/bin-prettier.js:44213:15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.