Skip to content

extensions should ignore imports from packages with invalid names #341

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

Closed
novemberborn opened this issue May 13, 2016 · 3 comments
Closed

Comments

@novemberborn
Copy link

Similar to #340, the extensions rule should ignore imports from packages with invalid names. E.g. files:../../content/**/*.md is not a file path, and not a valid package name.

I suppose this might have to deal with Windows file paths though.

@jfmengels
Copy link
Collaborator

Hi @novemberborn :)

Same as #340, do you have an example of a case where this is problematic for you? I'm not sure what kind of problem you're facing here.

@novemberborn
Copy link
Author

Sure. I maintain two Babel plugins which rewrite import statements: import-glob and files. An example of the latter is here:

import files from 'files:../../content/**/*.md'

The import isn't a file path (no leading / or disk drive, no leading period), and neither is files:.. a valid package name. Since the extensions rule only deals with file extensions, and this isn't a valid import (because it uses a custom resolver), I don't think the rule should apply.

I suppose this might be solved by writing a resolver for these Babel plugins (though I haven't checked whether this rule follows resolvers). It might be useful for this rule not to result in errors even if there is no custom resolver.

novemberborn added a commit to novemberborn/eslint-plugin-as-i-preach that referenced this issue May 16, 2016
@ljharb
Copy link
Member

ljharb commented Feb 18, 2020

The proper solution here is indeed to write a resolver.

@ljharb ljharb closed this as completed Feb 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants