question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Definition for rule 'import/no-extraneous-dependencies' was not found

See original GitHub issue

Hello.

I have this rule in my .eslintrc.json:

"import/no-extraneous-dependencies": [
          "warn",
          {
            "devDependencies": false,
            "optionalDependencies": false,
            "peerDependencies": false,
            "bundleDependencies": false,
            "packageDir": "./"
          }
        ]

But for a few files I have an error:

C:\Users\vlad\source\repos\project_name\src\environments\environment.ts
  1:1  error  Definition for rule 'import/no-extraneous-dependencies' was not found  import/no-extraneous-dependencies

Here’s file:

export const environment = {
  production: false,
  hmr: true,
  var1: "val1",
  var2: "val2",
  varn: "varn"
};

It’s not only for the env.file, but also for the files with just functions and even for some Angular components where I have a lot of import {} from ''. Everytime it fails on the first line, first symbol. Looks like this rule is just not working.

    "@angular-eslint/builder": "^2.0.2",
    "@angular-eslint/eslint-plugin": "2.0.2",
    "@angular-eslint/eslint-plugin-template": "^2.0.2",
    "@angular-eslint/schematics": "2.0.2",
    "@angular-eslint/template-parser": "2.0.2",
    "@typescript-eslint/eslint-plugin": "4.16.1",
    "@typescript-eslint/parser": "4.16.1",
    "eslint": "^7.23.0",
    "eslint-config-prettier": "^8.1.0",
    "eslint-plugin-import": "^2.22.1",
    "eslint-plugin-jsdoc": "^32.3.0",
    "eslint-plugin-prefer-arrow": "^1.2.3",
    "eslint-plugin-prettier": "^3.3.1",
    "eslint-plugin-sonarjs": "^0.6.0",

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

7reactions
AnthonyLzqcommented, Oct 4, 2021

I had the same issue, but in my case I forgot to extend the plugin in my eslintrc file, hope it helps.

5reactions
leotmcommented, Feb 16, 2022

Ran into this too ^ upgrading eslint from v7.32.0 -> v8.9.0

Both extends and manual config Failed to load plugin 'import' declared in '.eslintrc.js', which fixed/resolved by upgrading eslint-plugin-import from v2.24.2 -> v2.25.4

Read more comments on GitHub >

github_iconTop Results From Across the Web

eslint-plugin-import/no-extraneous-dependencies.md at main
Forbid the import of external modules that are not declared in the package.json 's dependencies , devDependencies , optionalDependencies , peerDependencies , or ......
Read more >
Why (and How Can I FIx) ESLint import/no-extraneous ...
If you arrived here while searching for 'Definition for rule 'import/no-extraneous-dependencies' was not found'.
Read more >
A Guide to ESLint | Laurie on Tech
While this is helpful, some rules need to get more specific. For example, ESLint has a rule called import/no-extraneous-dependencies . The goal ...
Read more >
node_modules/eslint-plugin-import/docs/rules/no-extraneous ...
Forbid the import of external modules that are not declared in the package.json 's dependencies , devDependencies , optionalDependencies , ...
Read more >
Why am I getting "Definition for rule 'import/no-extraneous ...
[Solved]-Why am I getting "Definition for rule 'import/no-extraneous-dependencies' was not found" when running ESLint?-babel.js · Related Query · More Query from ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found