1
votes

I am currently working with the vss-web-extension-sdk. I am using ESLint, eslint-plugin-import, and eslint-import-resolver-typescript to validate the files.

import { WidgetSettings, WidgetStatus } from "TFS/Dashboards/WidgetContracts";

The line above, extracted from my run.ts, throws the following error.

Unable to resolve path to module 'TFS/Dashboards/WidgetContracts'. eslint(import/no-unresolved).

However, when I control-click on the import in VSCode, it navigates to the module in tfs.d.ts. I am doing something incorrectly to make the resolver not detect the module?


My tsconfig.json has

{
    "compilerOptions": {
        "module": "amd",
        "strict": true,
        "moduleResolution": "node",
        "types": [
            "vss-web-extension-sdk"
        ]
    }
}

and my .eslintrc.json has

{
  "settings": {
    "plugins": [
      "import"
    ],
    "rules": {
      "import/no-unresolved": "error"
    },
    "import/resolver": {
      "typescript": {}
    }
  }
}

Install Commands

npm install --save-dev eslint-plugin-import typescript-eslint-parser eslint-import-resolver-typescript
npm install --save vss-web-extension-sdk
1

1 Answers

0
votes

Try setting your baseUrl and your rootDir in your tsconfig.json to specify where that absolute path starts.

See here: https://maxisam.github.io/2017/01/03/rootDirs-in-tsconfig/