Giter Club home page Giter Club logo

Comments (3)

kachkaev avatar kachkaev commented on May 31, 2024 1

Thanks for sharing the link @avh4!

When elm-format is installed globally via npm install --global elm-format, everything works fine. The case I'm mentioning in this issue is when you only run npm install --global prettier-plugin-elm, which in turn downloads and installs elm-format as its dependency to /usr/local/lib/node_modules/elm-format/. Unlike in local setups, there is no /usr/local/lib/node_modules/.bin folder, so spawning elm-format only involves a search in /usr/local/bin. This folder does not contain elm-format, because it has a status of a sub-dependency and npm decides not to pollute my global path with its binary.

Alternatively, I could move elm-format to peerDependencies and ask people to explicitly install it every time. But I guess it's better to keep this dependency tightly coupled with prettier-plugin-elm so save someone from using incompatible version pairs.

from prettier-plugin-elm.

avh4 avatar avh4 commented on May 31, 2024

I tried to make guidelines for plugins to follow (avh4/elm-format#104), which currently says the following:

  • Configuration
    • If the path to elm-format has not be explicitly specified by the user, the plugin should automatically find elm-format if it is located on the $PATH or in /usr/local/bin/.

      Is there an equivalent of /usr/local/bin/ for Windows?

      We should also add the path where npm install -g installs to, since this is the most common issue people have with plugin installation

    • If elm-format is not found, a message should be shown including a link to the elm-format installation instructions ( https://github.com/avh4/elm-format#installation- ). The message will be shown on the plugin settings screen if such a screen exists, and any time the user explicitly tries to format a file. The message may also be shown when the plugin is first installed or when saving an elm file.

I guess it needs to be updated to include a standard way for searching for elm-format installed with npm install -g, as you've noted. (Thought won't things installed that way generally be on the user's $PATH?)

from prettier-plugin-elm.

kachkaev avatar kachkaev commented on May 31, 2024

I believe this has been fixed in 6adc859, so there is no more need to install elm-format globally in order to make prettier-plugin-elm work.

Globally installed prettier still fails to load plugins due to prettier/prettier#4000, however, it is possible to install my fork while we are waiting for a new version that includes prettier/prettier#4192.

from prettier-plugin-elm.

Related Issues (9)

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.