Skip to content

This resolver adds `TypeScript` support to `eslint-plugin-import(-x)`

License

Notifications You must be signed in to change notification settings

import-js/eslint-import-resolver-typescript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

84db63d · Sep 27, 2019

History

37 Commits
Oct 26, 2018
Jul 25, 2019
Dec 12, 2018
Oct 8, 2018
Dec 13, 2018
Mar 4, 2019
Jul 25, 2019
Sep 27, 2019
Sep 27, 2019
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:

{
  "plugins": ["import"],
  "rules": {
    // turn on errors for missing imports
    "import/no-unresolved": "error"
  },
  "settings": {
    "import/parsers": {
      "@typescript-eslint/parser": [".ts", ".tsx"]
    },
    "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.