Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Rule proposal: detect useless template literal interpolation #2846

Closed
Labels
accepting prsGo ahead, send a pull request that resolves this issueenhancement: new plugin ruleNew rule request for eslint-pluginpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin
@karlhorky

Description

@karlhorky

Hi there,

First of all, thanks for this great set of ESLint + TS utilities, these are great!

I am unsure if I'm doing this right, because the issue template was about bug reports, but I would like to propose a new rule. Since I didn't see a template for this, I'm going to go ahead like this, and then can change it / resubmit if necessary.

What I wanted to bring up was the idea of a@typescript-eslint/no-useless-interpolation rule, similar to theeslint/eslint#10798 proposal to ESLint, which as far as I can tell, never got implemented.

The idea would be, if there is useless interpolation with a template string, this would be an error.

Example ofincorrect code:

`${'abc'}`// incorrectconststr='def';`${str}`// incorrect`123${'abc'}`// incorrect`${'abc'}${'def'}`// incorrect

Examples ofcorrect code:

'abc'// correctconststr='def';str// correct'123abc'// correct'abcdef'// correct

I would suggest only doing this for strings.

Remaining template things

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I haveread the FAQ and my problem is not listed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issueenhancement: new plugin ruleNew rule request for eslint-pluginpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp