Skip to content
Advertisement

Eslint with typescript complains it cant find a specific module

eslint complains for one of the module. The module is installed and the code works fine. Only eslint complains.

Unable to resolve path to module ‘@azure/functions’.eslintimport/no-unresolved

az/index.ts

import { AzureFunction, Context } from "@azure/functions";
import { SentMessageInfo } from "nodemailer";

.eslintrc.js

module.exports = {
  root: true,
  env: {
    es6: true,
    node: true,
  },
  extends: [
    "eslint:recommended",
    "plugin:@typescript-eslint/recommended",
    "plugin:import/errors",
    "plugin:import/warnings",
    "plugin:import/typescript",
    "google",
  ],
  parser: "@typescript-eslint/parser",
  parserOptions: {
    project: ["tsconfig.json", "tsconfig.dev.json"],
    sourceType: "module",
  },
  ignorePatterns: [
    "/lib/**/*", // Ignore built files.
  ],
  plugins: [
    "@typescript-eslint",
    "import",
  ],
  rules: {
    "require-jsdoc": ["error", {
      "require": {
        "FunctionDeclaration": false,
        "MethodDefinition": false,
        "ClassDeclaration": false,
        "ArrowFunctionExpression": false,
        "FunctionExpression": false,
      },
    }],
  },
};

folder structure

|__ .eslintrc.js
|__ az
    |__ index.ts

Advertisement

Answer

Do import { AzureFunction, Context } from "@azure/functions/Interfaces.d" I checked the code in node_modules and found that there is no index file

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement