eslint-plugin-absolute-importdeprecated

Use absolute imports.

Usage no npm install needed!

<script type="module">
  import eslintPluginAbsoluteImport from 'https://cdn.skypack.dev/eslint-plugin-absolute-import';
</script>

README

eslint-plugin-absolute-import

build status Coverage Status win32 build status npm npm downloads

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 exports.

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"
      ]
    }
  }
}