Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work correctly with package.json trick #1033

Closed
arnsa opened this issue Feb 28, 2018 · 4 comments
Closed

Doesn't work correctly with package.json trick #1033

arnsa opened this issue Feb 28, 2018 · 4 comments

Comments

@arnsa
Copy link

arnsa commented Feb 28, 2018

Hello,

so in my project I am using this little neat trick with package.json file. Let's say I have images folder and inside that folder I have a package.json file with only one line: { "name":"images" }. That way, I can use imports like this:

import MarkerImage from 'images/marker.png';

And it will work just fine. The problem is that eslint-plugin-import that it's unable to resolve path module and also that "images" should be listed in the project's dependencies. Is there any way to fix this without disabling these rules?

@ljharb
Copy link
Member

ljharb commented Feb 28, 2018

This "trick" is generally a bad practice (having nested package.json files), but I think this is related to #935 and #904?

@arnsa
Copy link
Author

arnsa commented Mar 1, 2018

@ljharb why is it considered a bad practice?

@ljharb
Copy link
Member

ljharb commented Mar 1, 2018

I wrote a bit about it here; in particular, it's just not a convention people expect.

@arnsa
Copy link
Author

arnsa commented Mar 1, 2018

Okay, I see. I've found a solution in one of the issues you've linked. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants