Eslint-plugin-import: eslint(import/no-extraneous-dependencies) for @expo/vector-icons imports

Created on 16 Feb 2019  路  10Comments  路  Source: benmosher/eslint-plugin-import

I am importing FontAwesome from @expo/vector-icon.

I get this linter error:

'@expo/vector-icons' should be listed in the project's dependencies. Run 'npm i -S @expo/vector-icons' to add iteslint(import/no-extraneous-dependencies)

How do I prevent this error?

bug help wanted

All 10 comments

npm install --save @expo/vector-icons?

I have the exact same problem & I do have all the dependencies in package.json in proper sections. I have react for example is in dependencies & still complaining.

These are all the eslint related packages I'm using in that project

    "babel-eslint": "10.0.1",
    "eslint": "5.15.1",
    "eslint-config-airbnb": "17.1.0",
    "eslint-config-prettier": "4.1.0",
    "eslint-import-resolver-webpack": "0.11.0",
    "eslint-plugin-flowtype": "3.4.2",
    "eslint-plugin-import": "2.16.0",
    "eslint-plugin-jsx-a11y": "6.2.1",
    "eslint-plugin-prettier": "3.0.1",
    "eslint-plugin-react": "7.12.4",
    "eslint-plugin-react-hooks": "1.5.0",

This is not happening in 2.14.0 started to happen from 2.15.0

fixed in 2.16? see solution in #1301?

For me, it still not working. Not in 2.16 or even 2.18

Vim:
Screen Shot 2019-06-29 at 09 26 16

VSCode
Screen Shot 2019-06-29 at 09 28 50

Node console

2.18
Screen Shot 2019-06-29 at 09 28 08

2.16
Screen Shot 2019-06-29 at 09 33 15

package.json & .eslintrc.js are in the same directory
Screen Shot 2019-06-29 at 09 36 52

Ignore that, sorry. I added the rule inside settings instead of rules.

The 2.22.1 version still has this problem, when I use @ant-design/icons

in .eslintrc.json

    "settings": {
      "import/core-modules": [
        "@expo/vector-icons"
      ]
    }

should solve the error message

in .eslintrc.json

    "settings": {
      "import/core-modules": [
        "@expo/vector-icons"
      ]
    }

should solve the error message

Could you explain, what this is doing?

Does this solve the issue EsLint is claiming here?
"If an import declaration's source is extraneous (it's not written in package.json), the program works in local, but will not work after dependencies are re-installed. It will cause troubles to your team/contributors. This rule disallows import declarations of extraneous modules. (https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-extraneous-import.md)"

The solution remains https://github.com/benmosher/eslint-plugin-import/issues/1289#issuecomment-464302909 as far as I鈥檓 aware.

Was this page helpful?
0 / 5 - 0 ratings