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.

Special-casing non-standard import syntax in no-extraneous-dependencies

See original GitHub issue

I’m using eslint-plugin-import with Parcel v2, which allows the definition of named pipelines such that I can import assets using a line like

import logoPng from "data-url:./logo.png";

I can make these imports resolvable by eslint-plugin-import by using the eslint-import-resolver-parcel2 package, and it works fine.

However, if I want to load an asset from an package installed in node_modules, e.g.:

import layersPng from "url:leaflet/dist/images/layers.png";

I get an error:'url:leaflet' should be listed in the project's dependencies. Run 'npm i -S url:leaflet' to add it.

Likewise if I try:

import layersPng from "url:./node_modules/leaflet/dist/images/layers.png";

then I get 'url:.' should be listed in the project's dependencies. Run 'npm i -S url:.' to add it.

I think the difference is that the resolved file name passes the external check here: https://github.com/benmosher/eslint-plugin-import/blob/master/src/rules/no-extraneous-dependencies.js#L125-L127

in the first case, and not in the second?

Is there anything I can do about this? Perhaps in the eslint-import-resolver-parcel2 plugin?

Related: an ignore facility à la #903 would provide a useful workaround in this case.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:18 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
dryomacommented, Mar 23, 2021

@ljharb It used to work for us prior to 2.20.1. At least it didn’t trigger eslint errors, so maybe such values were simply ignored.

1reaction
simonwilescommented, Jan 6, 2021

I’m not 100% au fait with what’s available in a Node.js environment, so I’ll do a bit of reading and then take a first pass at this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Special-casing non-standard import syntax in no-extraneous ...
I'm using eslint-plugin-import with Parcel v2, which allows the definition of named pipelines such that I can import assets using a line ...
Read more >
PECB-Exams.exe, pid - Joe Sandbox
Remove Node.js <= 0.11.3 special-casing from test case..4.1.2 ... Preview: support.test.examples.example. ... 'import/no-extraneous-dependencies': 0,.
Read more >
SpecialCasing.txt - Unicode
# Preserve canonical equivalence for I with dot. Turkic is handled below. # The following cases are already in the UnicodeData. txt file,...
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