eslint-plugin-absolute-import
This plugin intends to support linting of ES2015+ (ES6+) import/export syntax, and prevent issues with misspelling of file paths and import names. All the goodness that the ES2015+ static module syntax intends to provide, marked up in your editor.
Rules
Static analysis
- Forbid import of modules using relative paths ([
no-relative-path
]) - Forbid unresolved imports ([
no-unresolved
])
Installation
npm install eslint-plugin-absolute-import -g
or if you manage ESLint as a dev dependency:
# inside your project's working tree npm install eslint-plugin-absolute-import --save-dev
All rules are off by default.
Currently [Node] and [webpack] resolution have been implemented, but the resolvers are just npm packages, so third party packages are supported (and encouraged!).
Settings
You may set the following settings in your .eslintrc
:
import/extensions
A list of file extensions that will be parsed as modules and inspected for
export
s.
This defaults to ['.js']
, unless you are using the react
shared config,
in which case it is specified as ['.js', '.jsx']
.
"settings": "import/resolver": "node": "extensions": ".js" ".jsx"