I'm getting the following two errors on all TypeScript files using ESLint in VS Code:
Definition for rule 'import/extensions' was not found.eslint(import/extensions)
Definition for rule 'import/no-extraneous-dependencies' was not found.eslint(import/no-extraneous-dependencies)
A screenshot from VSC Problems pane:
Note on possible duplicates
There are many similar questions about different modules and even some about the import/extensions
, but none of the suggested solutions help. I've tried them all. I also tried every single solution posted in every single thread suggested by Stack Overflow while typing this question.
Here is my .eslintrc.json
:
{
"env": {
"es2021": true,
"node": true
},
"extends": [
"airbnb-typescript/base",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module",
"project": "./tsconfig.json"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"@typescript-eslint/no-use-before-define": "off"
}
}
package.json
:
{
"name": "graph-userdata-gateway",
"version": "1.0.0",
"description": "Gateway for PowerApps Microsoft Graph API custom connector to query user data with application permissions.",
"main": "src/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "[email protected]:powerapps/graph-userdata-gateway.git"
},
"author": "Benjamin Pettinen / YO-bitti Oy",
"license": "UNLICENSED",
"dependencies": {
"@microsoft/microsoft-graph-client": "^3.0.0",
"dedent": "^0.7.0",
"express": "^4.17.1",
"isomorphic-fetch": "^3.0.0",
"md5": "^2.3.0",
"node-fetch": "^2.6.1"
},
"devDependencies": {
"@types/dedent": "^0.7.0",
"@types/express": "^4.17.13",
"@types/isomorphic-fetch": "0.0.35",
"@types/md5": "^2.3.1",
"@types/node-fetch": "^2.5.12",
"@typescript-eslint/eslint-plugin": "^4.29.2",
"@typescript-eslint/parser": "^4.29.2",
"eslint": "^7.32.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-config-airbnb-typescript": "^13.0.0",
"eslint-plugin-import": "^2.24.1",
"typescript": "^4.3.5"
}
}
tsconfig.json
{
"compilerOptions": {
"target": "ES6",
"module": "CommonJS",
"esModuleInterop": true,
"noImplicitAny": true,
"moduleResolution": "Node",
"outDir": "dist",
"sourceMap": true
}
}
I've tried deleting the whole node_mobules
and re-running npm install
as well as played with the extends
in the .eslintrc.json
. If I remove airbnb-typescript/base
the error disappears, but I lose the Airbnb style from ESLint. Using airbnb-base
instead works, but then ESLint complains about Missing file extension for abc.ts
and Unable to resolve path to module abc
. I have also multiple time restarted VSC and the ESLint server.