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
Request: replacement for no-restricted-globals #345
Comments
Which rule is that? This sounds more of a configuration of the rule that is breaking than a case for a new rule. |
I mean when using the popular shared list at eslint-restricted-globals as config for the rule (as airbnb's config does). The fact is there are some fairly good reasons to restrict names like |
I don't see a technical reason this cannot be done. This sounds like the right fix. I suggest raising an issue with Flow. |
I'm using eslint-config-airbnb, which has
no-restricted-globals
set to disallow certain easily confusable globals, based on the eslint-restricted-globals list.But sometimes you want to use these globals in types, e.g. to reuse the type of
window.history
(defined here when creating a customisedhistory
for use with react-router:The ESLint config asks you to change it to
type History = typeof window.history
. But that doesn't work for Flow – the resulting type isany
, as Flow's type forwindow
is isany
. Same goes fortypeof global.history
.I think it would be useful for eslint-plugin-flowtype to add a new rule,
flowtype/no-restricted-globals
, which would allow using restricted globals in type annotations.The text was updated successfully, but these errors were encountered: