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

feat(eslint-plugin): remove no-useless-template-literals#9207

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,8 +14,6 @@ This rule reports template literals that contain substitution expressions (also
:::info[Migration from `no-useless-template-literals`]

This rule was formerly known as [`no-useless-template-literals`](./no-useless-template-literals.mdx).
We encourage users to migrate to the new name, `no-unnecessary-template-expression`, as the old name will be removed in a future major version of typescript-eslint.

The new name is a drop-in replacement with identical functionality.

:::
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,5 @@
---
description: 'Disallow unnecessary template literals.'
---
:::danger Deprecated

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
This rule has been renamed to [`no-unnecessary-template-expression`](./no-unnecessary-template-expression.mdx). See [#8544](https://github.com/typescript-eslint/typescript-eslint/issues/8544) for more information.

> 🛑 This file is source code, not the primary documentation location! 🛑
>
> See **https://typescript-eslint.io/rules/no-useless-template-literals** for documentation.

This rule reports template literals that contain substitution expressions (also variously referred to as embedded expressions or string interpolations) that are unnecessary and can be simplified.

:::warning
This rule is being renamed to [`no-unnecessary-template-expression`](./no-unnecessary-template-expression.mdx).
The current name, `no-useless-template-literals`, will be removed in a future major version of typescript-eslint.

After the creation of this rule, it was realized that the name `no-useless-template-literals` could be misleading, seeing as this rule only targets template literals with substitution expressions.
In particular, it does _not_ aim to flag useless template literals that look like `` `this` `` and could be simplified to `"this"`.
If you are looking for such a rule, you can configure the [`@stylistic/ts/quotes`](https://eslint.style/rules/ts/quotes) rule to do this.
:::

{/* Intentionally Omitted: When Not To Use It */}
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -39,7 +39,6 @@ export = {
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-unsafe-unary-minus': 'off',
'@typescript-eslint/no-useless-template-literals': 'off',
'@typescript-eslint/non-nullable-type-assertion-style': 'off',
'@typescript-eslint/only-throw-error': 'off',
'@typescript-eslint/prefer-destructuring': 'off',
Expand Down
2 changes: 0 additions & 2 deletionspackages/eslint-plugin/src/rules/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -85,7 +85,6 @@ import noUnusedVars from './no-unused-vars';
import noUseBeforeDefine from './no-use-before-define';
import noUselessConstructor from './no-useless-constructor';
import noUselessEmptyExport from './no-useless-empty-export';
import noUselessTemplateLiterals from './no-useless-template-literals';
import noVarRequires from './no-var-requires';
import nonNullableTypeAssertionStyle from './non-nullable-type-assertion-style';
import onlyThrowError from './only-throw-error';
Expand DownExpand Up@@ -210,7 +209,6 @@ export default {
'no-use-before-define': noUseBeforeDefine,
'no-useless-constructor': noUselessConstructor,
'no-useless-empty-export': noUselessEmptyExport,
'no-useless-template-literals': noUselessTemplateLiterals,
'no-var-requires': noVarRequires,
'non-nullable-type-assertion-style': nonNullableTypeAssertionStyle,
'only-throw-error': onlyThrowError,
Expand Down
176 changes: 0 additions & 176 deletionspackages/eslint-plugin/src/rules/no-useless-template-literals.ts
View file
Open in desktop

Choose a reason for hiding this comment

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

Just want to call out that this will probably cause merge conflicts when#8688 and#8673 get merged to main. But, the resolution is basically trivial (prefer this changeset over the other one), so I'm guessing there's no reason to consider blocking the PR or anything.

cc@JoshuaKGoldberg

JoshuaKGoldberg reacted with thumbs up emoji

Choose a reason for hiding this comment

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

Yup, agreed!

kirkwaiblinger reacted with thumbs up emoji

This file was deleted.

This file was deleted.

1 change: 1 addition & 0 deletionspackages/eslint-plugin/tests/docs.test.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -157,6 +157,7 @@ describe('Validating rule docs', () => {
// comments in the files for more information.
'no-duplicate-imports.mdx',
'no-parameter-properties.mdx',
'no-useless-template-literals.mdx',
...oldStylisticRules,
]);

Expand Down
Loading
Loading

[8]ページ先頭

©2009-2025 Movatter.jp