Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

import-blacklist: allow package name preferences? #3843

Closed
JoshuaKGoldberg opened this issue Apr 18, 2018 · 3 comments
Closed

import-blacklist: allow package name preferences? #3843

JoshuaKGoldberg opened this issue Apr 18, 2018 · 3 comments

Comments

@JoshuaKGoldberg
Copy link
Contributor

(forking from microsoft/tslint-microsoft-contrib#422)

When there are two modules that declare variables with the same name, it's easy to mistakenly import from the wrong package:

import { action } from "mobx"; // this one?
import { action } from "mobx-safe"; // or this one?

A rule that lets projects map imports to their preferred package imports would help:

{
    "rules": {
        "import-blacklist": [
            true,
            "rxjs",
            {
                "mobx-safe": {
                    "action": {
                        "override": ["*"],
                        "reason": ["Technical mumbo jumbo..."]
                    }
                }
            }
        ]
    }
}

...though this config could be misleading, as the "rxjs" setting tends away from that module while "mobx-safe"'s tends towards that one. I'm not sure if I have a preference to add to import-blacklist or make a new rule.

@ethanresnick
Copy link
Contributor

@JoshuaKGoldberg Would my PR here address your use case? #3926

@JoshuaKGoldberg
Copy link
Contributor Author

Looks like it!

@JoshuaKGoldberg
Copy link
Contributor Author

Fixed by #3926 🙌

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants