linter-flow
linter-flow copied to clipboard
Should support use project local flow bin
I use linter-flow without npm i -g flow-bin
, and get error:
~/.atom/packages/linter/lib/linter-registry.js:159 [Linter] Error running Flow Error: Failed to spawn command
flow
. Make sureflow
is installed and on your PATH
I think linter-flow should support use project local flow bin as optional, for example use <project root>/node_modules/.bin/flow
if it exists, so we can use the same version of flow bin for both Atom's linter-flow and command npm run flow
.
Any updates on this?
This is also reflected in the Flow install docs as a best practice: https://flow.org/en/docs/install/
Flow works best when installed per-project with explicit versioning rather than globally.
I thought using local flow didn't work when I was looking into this yesterday, but it turns out that I had my linter package disabled. I'm using linter-flow 5.6.0, I set ./node_modules/.bin/flow
as my flow executable in linter-flow's settings, and it's working as expected.
Hope that's useful to someone.
It makes sense that that setting would work, but I don't feel it's very intuitive + the default assumption is a global install when that seems like it should be the special case (with the default to using node_modules
)
I was looking at how AtomLinter/linter-eslint accomplishes using local vs global versions of the linting tool (though it seems I might be unaware of certain requirements specifically relating to flow running as a server) and it seems like some of that logic can be ported pretty readily. I would be a fan of a simpler solution to default to ./node_modules/.bin/flow
unless a global instance is indicated, but I think this falls short when working directories are set inside/outside that root directory where node_modules
lives.
Hoping to submit a PR for this issue soon!
For anyone else on Windows, you'll need to use backslashes instead of forward slashes (.\node_modules\.bin\flow
)
I can't get the ./node_modules/.bin/flow
trick to work and would really prefer either than flow was bundled in the plugin or that the plugin was able to find and use a local flow binary rather than installing one globally.
+1 for project specific "local". This is how linter-eslint works and so that should this very one also followed same pattern
This is a rough first pass: https://github.com/AtomLinter/linter-flow/pull/180
I think I'm getting the same issue, but I have the linter package enabled.
[Linter] Error running Flow Error: Failed to spawn command flow
. Make sure flow
is installed and on your PATH
Or is this a different issue?
This in particular makes it even less obvious