Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upStandard reports unfixable errors for Flow code #1045
Comments
This comment has been minimized.
This comment has been minimized.
on3iro
commented
Jan 16, 2018
|
This is an issue with babel-eslint. Try to downgrade babel-eslint to 8.0.3 then it should work :) |
This comment has been minimized.
This comment has been minimized.
|
@on3iro, thanks! I confirm that running the following command makes $ yarn add --dev babel-eslint@8.0.3Even with this workaround, I'm still having problems with my real project. I'll investigate some more and close this issue if my other problems are unrelated. |
This comment has been minimized.
This comment has been minimized.
|
I think I figured out what's wrong with my project. Installing $ yarn add --dev lab
...
$ yarn run standard --parser babel-eslint --plugin flowtype
yarn run v1.3.2
$ /Users/mg/Projects/standard-js-flow-issue/node_modules/.bin/standard --parser babel-eslint --plugin flowtype
standard: Use JavaScript Standard Style (https://standardjs.com)
/Users/mg/Projects/standard-js-flow-issue/index.js:4:3: '_greeting' is not defined.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I'm not very familiar with Node's module system. Is Standard using eslint incorrectly? Is this a bug in Yarn? Is something broken in lab? I tried to work around this issue by explicitly installing $ yarn add --dev eslint@3.19.0
...
$ yarn run standard --parser babel-eslint --plugin flowtype
yarn run v1.3.2
$ /Users/mg/Projects/standard-js-flow-issue/node_modules/.bin/standard --parser babel-eslint --plugin flowtype
standard: Use JavaScript Standard Style (https://standardjs.com)
/Users/mg/Projects/standard-js-flow-issue/index.js:4:3: '_greeting' is not defined.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.Script to reproduce: https://gist.github.com/strager/02f2dbebb3a4f5aafeb0b0fa4041936f/74231871320c68db7dd08be67fb8c0aff80270ef#file-set_up-sh Side note: Standard's cache is broken. I had to run |
This comment has been minimized.
This comment has been minimized.
|
I had the same issue with npm, so I don't think this issue is Yarn's fault: $ rm -rf node_modules
$ npm install
...
$ ./node_modules/.bin/standard --parser babel-eslint --plugin flowtype
standard: Use JavaScript Standard Style (https://standardjs.com)
/Users/mg/Projects/standard-js-flow-issue/index.js:4:3: '_greeting' is not defined. |
This comment has been minimized.
This comment has been minimized.
|
With lab installed, installing
I have no idea why this works or why |
This comment has been minimized.
This comment has been minimized.
stale
bot
commented
May 10, 2018
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
stale
bot
added
the
stale
label
May 10, 2018
This comment has been minimized.
This comment has been minimized.
|
Edit: Meant v11 instead of v12. |
feross
closed this
May 11, 2018
This comment has been minimized.
This comment has been minimized.
lithium2013
commented
May 22, 2018
|
@feross Maybe you mean |
This comment has been minimized.
This comment has been minimized.
|
@lithium2013 Yes, I meant v11. |
strager commentedJan 15, 2018
•
edited
I followed these instructions to set up Standard with Flow support: https://standardjs.com/#can-i-use-a-javascript-language-variant-like-flow-or-typescript
Unfortunately, Standard reports problems I don't know how to fix. For example, in the following code, I have a Flow-annotated class property called
_greeting:For this code, Standard reports the following problem:
If I remove line 4 which declares
_greeting, Standard no longer reports the problem, but now Flow complains:How can I make both Standard and Flow happy for this code?
The following script lets you reproduce the problem from scratch: https://gist.github.com/strager/02f2dbebb3a4f5aafeb0b0fa4041936f/b77094b402bb8ed5cb55e304205a206543696b78#file-set_up-sh (That Gist also includes my yarn.lock file so you can see what version of the packages I installed.)