Skip to content

import-js/eslint-import-resolver-typescript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

e6c1382 · Dec 13, 2018

History

23 Commits
Oct 26, 2018
Dec 13, 2018
Dec 12, 2018
Oct 8, 2018
Dec 13, 2018
Dec 13, 2018
Oct 26, 2018
Oct 26, 2018
Oct 26, 2018
Dec 13, 2018

Repository files navigation

eslint-import-resolver-typescript

Build Status

This plugin adds typescript support to eslint-plugin-import.

This means you can:

  • import/require files with extension .ts/.tsx!
  • Use paths defined in tsconfig.json.

Installation

npm install --save-dev eslint-plugin-import typescript-eslint-parser eslint-import-resolver-typescript

Configuration

Add the following to your .eslintrc config:

{
  "parser": "typescript-eslint-parser",
  "plugins": ["import"],
  "rules": {
    // turn on errors for missing imports
    "import/no-unresolved": "error"
  },
  "settings": {
    "import/resolver": {
      // use <root>/tsconfig.json
      "typescript": {},

      // use <root>/path/to/folder/tsconfig.json
      "typescript": {
        "directory": "./path/to/folder"
      }
    }
  }
}

Contributing

  • Make sure your change is covered by a test import.
  • Make sure that npm test passes without a failure.
  • Make sure your code is formatted npm format.

We have an automatic travis build which will run the above on your PRs. If either fails, we won't be able to merge your PR until it's fixed.