I'm encountering two errors across all TypeScript files in ESLint on VS Code:
Not able to find definition for rule 'import/extensions'.eslint(import/extensions)
Not able to find definition for rule 'import/no-extraneous-dependencies'.eslint(import/no-extraneous-dependencies)
Here's a snapshot from the VSC Problems pane:
https://i.stack.imgur.com/lq3Vu.png
Important Note
While there are many similar queries regarding different modules and some concerning import/extensions
, none of the proposed solutions have been effective. I've tested them all, along with every solution suggested by Stack Overflow during the formulation of this question.
This 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": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2e49475a6e49475b404d4f0352434d465b5b46404b4e">[email protected]</a>: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 attempted removing the entire node_modules
folder followed by rerunning npm install
and adjusting the extends
section in the .eslintrc.json
file. When eliminating airbnb-typescript/base
, the error vanishes but forfeits the Airbnb style provided by ESLint. Using airbnb-base
resolves the issue, but then ESLint raises concerns about
Missing file extension for abc.ts
and Unable to resolve path to module abc
. Additionally, I restarted VSC several times along with resetting the ESLint server.