import-js / eslint-plugin-import

ESLint plugin with rules that help validate proper imports.
MIT License
5.54k stars 1.57k forks source link

Resolve index.js.flow files in npm modules (matching flow-cli behavior) #927

Open SpainTrain opened 7 years ago

SpainTrain commented 7 years ago

It is appears not possible to import types that are exported by an npm module in a natural way. For example, this works with flow but results in named error from eslint-plugin-import

import type {FormProps} from 'redux-form'

but this works and results in no eslint error

import type {FormProps} from 'redux-form/es/index.js.flow'

additionally

import type {FormProps} from 'redux-form/lib/index.js.flow'

I am happy to dig into root cause more (opening this now for tracking), but my guess is that the package.json module/main entries aren't being followed to find index.js.flow files. E.g., these fields in redux-form are

  "main": "./lib/index.js",
  "module": "./es/index.js",
  "jsnext:main": "./es/index.js",
danrot commented 6 years ago

Is it possible that this is only happening for interfaces?