Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Allow more forms of specifiers in the config for import-name #451

Closed
JoshuaKGoldberg opened this issue Jul 5, 2018 · 5 comments · Fixed by #522
Closed

Allow more forms of specifiers in the config for import-name #451

JoshuaKGoldberg opened this issue Jul 5, 2018 · 5 comments · Fixed by #522
Labels
Difficulty: Easy Someone with little to no experience in TSLint should be able to send a pull request for this issue. Good First Issue 🙌 Howdy, neighbor! Status: Accepting PRs Type: Rule Feature Adding a feature to an existing rule.
Milestone

Comments

@JoshuaKGoldberg
Copy link

JoshuaKGoldberg commented Jul 5, 2018

Continuing discussion from #387 and #429: we should allow both "graphql-tag" and "graphqlTag" in the config for import-name.

At the very least, adding _ should be done here.

/cc @massimonewsuk @levithomason

@JoshuaKGoldberg JoshuaKGoldberg added Difficulty: Easy Someone with little to no experience in TSLint should be able to send a pull request for this issue. Status: Accepting PRs Good First Issue 🙌 Howdy, neighbor! Type: Rule Feature Adding a feature to an existing rule. labels Jul 5, 2018
@monicbhanushali
Copy link
Contributor

Hi @JoshuaKGoldberg , I am a novice to typescript and would like to contribute to this issue for hacktoberfest

@JoshuaKGoldberg
Copy link
Author

Awesome, please do!

@monicbhanushali
Copy link
Contributor

As per discussion #429, it should also provide ability to support entire path as replacementKey.

Proposed in #429

import _ from 'lodash'
import _ from 'lodash/fp'
import ReactDOMServer from 'react-dom/server'
"import-name": [true, {
  "lodash": "_",
  "lodash/fp": "_",
  "react-dom/server": "ReactDOMServer"
}]

So as per my understanding, this change should allow replacement-key to be entered in three ways:

Example:
import ReactDOMServerTag from 'react-dom/server-tag' 

Possible ways to provide exception for import-name rule:

"import-name": [true, { "react-dom/server-tag": "ReactDOMServerTag"}]
or
"import-name": [true, { "server-tag": "ReactDOMServerTag"}]
or
"import-name": [true, { "serverTag": "ReactDOMServerTag"}]

@JoshuaKGoldberg is my understanding correct ?

@monicbhanushali
Copy link
Contributor

monicbhanushali commented Oct 6, 2018

@JoshuaKGoldberg I have raised basic PR-522 to address this issue and is open for review.

@JoshuaKGoldberg
Copy link
Author

JoshuaKGoldberg commented Oct 7, 2018

Hi yes, awesome! Your understanding looks good to me! Will follow up in the PR.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
Difficulty: Easy Someone with little to no experience in TSLint should be able to send a pull request for this issue. Good First Issue 🙌 Howdy, neighbor! Status: Accepting PRs Type: Rule Feature Adding a feature to an existing rule.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants