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

feat(eslint-plugin): [no-useless-template-literals] add new rule #7957

Conversation

StyleShit
Copy link
Contributor

Closes #2846

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @StyleShit!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint.

Copy link

netlify bot commented Nov 19, 2023

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 408e5c7
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/657890ae3d0840000917c4a3
😎 Deploy Preview https://deploy-preview-7957--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 90 (🔴 down 7 from production)
Accessibility: 100 (no change from production)
Best Practices: 92 (no change from production)
SEO: 98 (no change from production)
PWA: 80 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

Comment on lines 68 to 71
context.report({
node,
messageId: 'noUselessTemplateLiteral',
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should probably add a fixer in another PR
will raise a new issue after this one is merged

Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 a great start! Requested some changes that I suspect might require some code changes. Can take a deeper look once they're resolved. Many thanks for sending this in!

Mr. Burns saying 'excellent' from The Simpsons

@JoshuaKGoldberg JoshuaKGoldberg added the awaiting response Issues waiting for a reply from the OP or another party label Nov 20, 2023
@github-actions github-actions bot removed the awaiting response Issues waiting for a reply from the OP or another party label Nov 20, 2023
@StyleShit
Copy link
Contributor Author

IDK why prettier is failing, seems to be fine locally

Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting closer, fantastic! 🥳

Mostly requesting changes on making the rule not flag stylistic points. On deeper thought I think there's some more testing to be done too.

Thanks!

@JoshuaKGoldberg JoshuaKGoldberg added the awaiting response Issues waiting for a reply from the OP or another party label Dec 5, 2023
@github-actions github-actions bot removed the awaiting response Issues waiting for a reply from the OP or another party label Dec 10, 2023
@StyleShit
Copy link
Contributor Author

no idea why the build is failing

@JoshuaKGoldberg
Copy link
Member

JoshuaKGoldberg commented Dec 11, 2023

Btw @StyleShit I appreciate you answering every thread 🙂 but if it's easier for you, you can just mark them as resolved. That's the flow we usually use when it's a straightforward "yes"/"done".

@JoshuaKGoldberg
Copy link
Member

no idea why the build is failing

Yeah 🙁 not related to this PR. Should be fixed by #8048. I'll update the branch.

@StyleShit
Copy link
Contributor Author

StyleShit commented Dec 11, 2023

Btw @StyleShit I appreciate you answering every thread 🙂 if it's easier for you, you can just mark them as resolved.

@JoshuaKGoldberg
Hehe that's the force of a habit...
At Elementor, we usually answer every thread to make sure we didn't miss anything, and let the reviewer resolve the thread.
It helps the reviewers keeping track of the discussions and put themselves back into context on a re-review.

We usually either answer with "done" or start a discussion about the review comment.

@JoshuaKGoldberg
Copy link
Member

JoshuaKGoldberg commented Dec 11, 2023

I, yet again, am resentful that GitHub's PR process doesn't give a way to distinguish between "one of us in this conversation thinks it's resolved" and "both of us in this conversation think it's resolved"... 🙃

Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok this is looking great! Thanks for keeping working on it. 🙌

Apologies for the late-breaking request: I think the only blocker (other than reverting unrelated changes) is also reporting on unnecessary non-string literals such as bigint and number. Or at least, resolving the conversation around them is.

@JoshuaKGoldberg JoshuaKGoldberg added the awaiting response Issues waiting for a reply from the OP or another party label Dec 11, 2023
@github-actions github-actions bot removed the awaiting response Issues waiting for a reply from the OP or another party label Dec 12, 2023
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(just #7957 (comment) left)

@JoshuaKGoldberg JoshuaKGoldberg added the awaiting response Issues waiting for a reply from the OP or another party label Dec 12, 2023
@github-actions github-actions bot removed the awaiting response Issues waiting for a reply from the OP or another party label Dec 12, 2023
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎆 this is great, thanks for all your work on it!

Looking forward to getting this into recommended for v7 😄

@JoshuaKGoldberg JoshuaKGoldberg merged commit ff75785 into typescript-eslint:main Dec 12, 2023
44 of 56 checks passed
@StyleShit
Copy link
Contributor Author

filed a new issue as promised:
#8056

@karlhorky
Copy link

Just tested this in @typescript-eslint/eslint-plugin@6.15.0 and it works well, thanks @StyleShit and @JoshuaKGoldberg and everyone else involved! 🙌

@Zamiell
Copy link
Contributor

Zamiell commented Dec 19, 2023

thanks Style, this is a very nice rule!
it caught bugs in my codebase : )

Vylpes pushed a commit to Vylpes/Droplet that referenced this pull request Dec 25, 2023
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint) | devDependencies | minor | [`6.10.0` -> `6.15.0`](https://renovatebot.com/diffs/npm/@typescript-eslint%2feslint-plugin/6.10.0/6.15.0) |

---

### Release Notes

<details>
<summary>typescript-eslint/typescript-eslint (@&#8203;typescript-eslint/eslint-plugin)</summary>

### [`v6.15.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#6150-2023-12-18)

[Compare Source](typescript-eslint/typescript-eslint@v6.14.0...v6.15.0)

##### Features

-   **eslint-plugin:** \[no-useless-template-literals] add new rule ([#&#8203;7957](typescript-eslint/typescript-eslint#7957)) ([ff75785](typescript-eslint/typescript-eslint@ff75785)), closes [#&#8203;2846](typescript-eslint/typescript-eslint#2846)
-   require-array-sort-compare + toSorted ([#&#8203;8052](typescript-eslint/typescript-eslint#8052)) ([c9661c8](typescript-eslint/typescript-eslint@c9661c8))

You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.

### [`v6.14.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#6140-2023-12-11)

[Compare Source](typescript-eslint/typescript-eslint@v6.13.2...v6.14.0)

##### Bug Fixes

-   **eslint-plugin:** add no-unsafe-unary-minus, prefer-destructuring to disable-type-checked ([#&#8203;8038](typescript-eslint/typescript-eslint#8038)) ([431cd15](typescript-eslint/typescript-eslint@431cd15))
-   **eslint-plugin:** correct message for `no-unsafe-unary-minus` ([#&#8203;7998](typescript-eslint/typescript-eslint#7998)) ([705370a](typescript-eslint/typescript-eslint@705370a))

##### Features

-   **eslint-plugin:** \[explicit-function-return-type] add support for typed class property definitions ([#&#8203;8027](typescript-eslint/typescript-eslint#8027)) ([bff47d7](typescript-eslint/typescript-eslint@bff47d7))
-   **eslint-plugin:** \[require-await] allow yielding Promise in async generators ([#&#8203;8003](typescript-eslint/typescript-eslint#8003)) ([4c3e704](typescript-eslint/typescript-eslint@4c3e704))

You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.

#### [6.13.2](typescript-eslint/typescript-eslint@v6.13.1...v6.13.2) (2023-12-04)

**Note:** Version bump only for package [@&#8203;typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/eslint-plugin)

You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.

#### [6.13.1](typescript-eslint/typescript-eslint@v6.13.0...v6.13.1) (2023-11-28)

**Note:** Version bump only for package [@&#8203;typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/eslint-plugin)

You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.

### [`v6.13.2`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#6132-2023-12-04)

[Compare Source](typescript-eslint/typescript-eslint@v6.13.1...v6.13.2)

**Note:** Version bump only for package [@&#8203;typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/eslint-plugin)

You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.

### [`v6.13.1`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#6131-2023-11-28)

[Compare Source](typescript-eslint/typescript-eslint@v6.13.0...v6.13.1)

**Note:** Version bump only for package [@&#8203;typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/eslint-plugin)

You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.

### [`v6.13.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#6130-2023-11-27)

[Compare Source](typescript-eslint/typescript-eslint@v6.12.0...v6.13.0)

**Note:** Version bump only for package [@&#8203;typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/eslint-plugin)

You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.

### [`v6.12.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#6120-2023-11-20)

[Compare Source](typescript-eslint/typescript-eslint@v6.11.0...v6.12.0)

##### Bug Fixes

-   **eslint-plugin:** \[class-methods-use-this] detect a problematic case for private/protected members if `ignoreClassesThatImplementAnInterface` is set ([#&#8203;7705](typescript-eslint/typescript-eslint#7705)) ([155aa1f](typescript-eslint/typescript-eslint@155aa1f))
-   **eslint-plugin:** \[no-unnecessary-condition] fix false positive with computed member access and branded key type ([#&#8203;7706](typescript-eslint/typescript-eslint#7706)) ([f151b26](typescript-eslint/typescript-eslint@f151b26))
-   **eslint-plugin:** \[switch-exhaustiveness-check] enum members with new line or single quotes are not being fixed correctly ([#&#8203;7806](typescript-eslint/typescript-eslint#7806)) ([a034d0a](typescript-eslint/typescript-eslint@a034d0a)), closes [#&#8203;7768](typescript-eslint/typescript-eslint#7768)

##### Features

-   \[member-ordering] add accessor support for member-ordering ([#&#8203;7927](typescript-eslint/typescript-eslint#7927)) ([3c8312d](typescript-eslint/typescript-eslint@3c8312d))
-   **eslint-plugin:** \[switch-exhaustiveness-check] add requireDefaultForNonUnion option ([#&#8203;7880](typescript-eslint/typescript-eslint#7880)) ([4cfcd45](typescript-eslint/typescript-eslint@4cfcd45))

You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.

### [`v6.11.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#6110-2023-11-13)

[Compare Source](typescript-eslint/typescript-eslint@v6.10.0...v6.11.0)

##### Bug Fixes

-   **eslint-plugin:** \[explicit-function-return-type] support JSX attributes in `allowTypedFunctionExpressions` ([#&#8203;7553](typescript-eslint/typescript-eslint#7553)) ([be2777c](typescript-eslint/typescript-eslint@be2777c))
-   **eslint-plugin:** \[no-unnecessary-qualifier] handle nested namespace id ([#&#8203;7883](typescript-eslint/typescript-eslint#7883)) ([a668f5b](typescript-eslint/typescript-eslint@a668f5b))

##### Features

-   add `no-unsafe-unary-minus` rule ([#&#8203;7390](typescript-eslint/typescript-eslint#7390)) ([c4709c2](typescript-eslint/typescript-eslint@c4709c2))
-   add types for flat config files ([#&#8203;7273](typescript-eslint/typescript-eslint#7273)) ([66cd0c0](typescript-eslint/typescript-eslint@66cd0c0))
-   allow typescript@5.3.0-RC as devDependency ([#&#8203;7821](typescript-eslint/typescript-eslint#7821)) ([b6c40b4](typescript-eslint/typescript-eslint@b6c40b4))
-   **eslint-plugin:** no-unsafe-enum-comparison handles switch cases ([#&#8203;7898](typescript-eslint/typescript-eslint#7898)) ([72cb9e4](typescript-eslint/typescript-eslint@72cb9e4))
-   **utils:** add ESLint `CodePath` selector types ([#&#8203;7551](typescript-eslint/typescript-eslint#7551)) ([99a026f](typescript-eslint/typescript-eslint@99a026f))

You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4wLjAiLCJ1cGRhdGVkSW5WZXIiOiIzNy4wLjAiLCJ0YXJnZXRCcmFuY2giOiJkZXZlbG9wIn0=-->

Reviewed-on: https://gitea.vylpes.xyz/RabbitLabs/Droplet/pulls/242
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rule proposal: detect useless template literal interpolation
5 participants