import/namespace
Enforces names exist at the time they are dereferenced, when imported as a full namespace (i.e. import * as foo from './foo'; foo.bar(); will report if bar is not exported by ./foo.).
Will report at the import declaration if there are no exported names found.
Also, will report for computed references (i.e. foo["bar"]()).
Reports on assignment to a member of an imported namespace.
Note: for packages, the plugin will find exported names from jsnext:main, if present in package.json. Redux's npm module includes this key, and thereby is lintable, for example.
A module path that is ignored or not unambiguously an ES module will not be reported when imported.
Rule Details
Currently, this rule does not check for possible redefinition of the namespace in an intermediate scope. Adherence to the ESLint no-shadow rule for namespaces will prevent this from being a problem.
For ES7, reports if an exported namespace would be empty (no names exported from the referenced module.)
Given:
and:
See what is valid and reported:
Options
allowComputed
Defaults to false. When false, will report the following:
When set to true, the above computed namespace member reference is allowed, but still can't be statically analyzed any further.
Further Reading
Lee Byron's ES7 export proposal
import/ignoresetting