eslint-plugin-import icon indicating copy to clipboard operation
eslint-plugin-import copied to clipboard

declaring package in subfolder and the "should be listed in the project's dependencies" error

Open fnicastri opened this issue 8 years ago • 4 comments

Hi,

I'm trying to configure eslint with the airbnb config for my react native project. To have nicer import statements I've a package.json in my src folder in which i declare a new 'src' package so I can have import like:

import ExamForm from "src/containers/examFormContainer";

and not like:

import ExamForm from "../../../../containers/examFormContainer";

but can't find how configure eslint-plugin-import to not throw the "src should be listed in the project's dependencies". How I can configure it?

this is the sub folder's package.json file

{
    "name":"src",
    "version":"0.1.0"
}

Thanks, Frank

fnicastri avatar Jul 26 '17 10:07 fnicastri

No one can help?

fnicastri avatar Aug 09 '17 19:08 fnicastri

+1

I would like to know how to deal with this situation as well?

bitcrumb avatar Aug 10 '17 13:08 bitcrumb

I've added the dependencies to my package.json under "dependencies" as follows:

  "api": "./src/api",
  "core": "./src/core",
  "common": "./src/common"

This will effectively create symlinks in your node_modules folder to the specified directories. And it will also resolve the warnings/errors you get.

bitcrumb avatar Aug 10 '17 13:08 bitcrumb

Thanks. But I've disabled the check. Maybe after this project I will try it.

Frank

fnicastri avatar Sep 15 '17 16:09 fnicastri