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

Bug: [no-type-alias] template literals are unhandled #5043

Closed
4 tasks done
burtek opened this issue May 23, 2022 · 3 comments · Fixed by #5092
Closed
4 tasks done

Bug: [no-type-alias] template literals are unhandled #5043

burtek opened this issue May 23, 2022 · 3 comments · Fixed by #5092
Labels
accepting prs Go ahead, send a pull request that resolves this issue bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@burtek
Copy link
Contributor

burtek commented May 23, 2022

Before You File a Proposal Please Confirm You Have Done The Following...

My proposal is suitable for this project

  • I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).

Link to the rule's documentation

https://typescript-eslint.io/rules/no-this-alias/

Description

Currently when aliasing template literal type, an error is thrown with message "Type unhandled are not allowed"

image

This rule should recognise template literal type. Additionally, a new option allowTemplateLiteral should be introduced to control rule's behaviour similarly to other options in this rule.

Fail

// with allowTemplateLiteral: false (default)
type SlashCommand = `/${string}`

Additional Info

No response

@burtek burtek added enhancement: plugin rule option New rule option for an existing eslint-plugin rule package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels May 23, 2022
@bradzacher bradzacher added bug Something isn't working accepting prs Go ahead, send a pull request that resolves this issue and removed triage Waiting for maintainers to take a look enhancement: plugin rule option New rule option for an existing eslint-plugin rule labels May 23, 2022
@bradzacher bradzacher changed the title Enhancement: [no-type-alias] allowTemplateLiteral Bug: [no-type-alias] allowTemplateLiteral May 23, 2022
@JoshuaKGoldberg
Copy link
Member

JoshuaKGoldberg commented May 28, 2022

Posting back after reviewing #5092: I don't think there's a strong need for a new allowTemplateLiteral option. The rule already has basic handling for strings. If #5092 is merged but you still want it, I'd suggest filing another issue.

@burtek
Copy link
Contributor Author

burtek commented May 29, 2022

I don't think there's a strong need for a new allowTemplateLiteral option. The rule already has basic handling for strings.

@JoshuaKGoldberg how would you setup no-type-alias to allow template literals though?

@burtek burtek changed the title Bug: [no-type-alias] allowTemplateLiteral Bug: [no-type-alias] template literals are unhandled May 29, 2022
@JoshuaKGoldberg
Copy link
Member

I'll answer in #5095 - thanks for filing!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepting prs Go ahead, send a pull request that resolves this issue bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants