Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Valid Flow fails #1106

Closed
vmx opened this issue Apr 4, 2018 · 2 comments

Comments

@vmx
Copy link

commented Apr 4, 2018

According to the website Flow is supported. But this example:

// @flow
const planets = {
  earth: 12756,
  mars: 6792
}
type Planet = $Keys<typeof planets>
const planet: Planet = 'mars'
return planet

fails with:

$ npx standard --parser babel-eslint --plugin flowtype minimal.js
standard: Use JavaScript Standard Style (https://standardjs.com)
  /home/vmx/tmp/eslintflow/minimal.js:6:15: '$Keys' is not defined.

The rule flowtype/define-flow-type would solve the problem. But if you would add this rule to eslint-config-standard'a eslintrc.json it would error if you run standard withoutt the --plugin flowtype.

Is there a way to resolve this problem that would be accepted? I'd be happy to work on a PR.

@vmx

This comment has been minimized.

Copy link
Author

commented Apr 5, 2018

After having a closer look. What about making standard to do an "extends": "plugin:flowtype/recommended" if the flowtype plugin is specified?

Would such a change be accepted.

@feross

This comment has been minimized.

Copy link
Member

commented May 15, 2018

@vmx It's intentionally not easy to enable additional rules in standard, though in certain situations like yours, this can cause some trouble.

In the meantime, I recommend using standardx which provides an escape-hatch of sorts for these types of situations. It allows you enable additional rules.

Eventually, I'd like to solve this problem more elegantly in a future version of standard.

@feross feross closed this May 15, 2018

@feross feross added the question label May 15, 2018

@lock lock bot locked as resolved and limited conversation to collaborators Aug 13, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
2 participants
You can’t perform that action at this time.