Skip to content

feat: implement unnecessaryTemplateExpressions rule (TypeScript)#2251

Draft
Copilot wants to merge 6 commits intomainfrom
copilot/add-unnecessary-template-expressions-rule
Draft

feat: implement unnecessaryTemplateExpressions rule (TypeScript)#2251
Copilot wants to merge 6 commits intomainfrom
copilot/add-unnecessary-template-expressions-rule

Conversation

Copy link
Contributor

Copilot AI commented Jan 31, 2026

Implements unnecessaryTemplateExpressions rule to detect template literals containing only a single substitution with no surrounding text.

Rule Behavior

Flags template expressions like `${value}` that add unnecessary syntax noise:

// ❌ Flagged
const name = "Alice";
const greeting = `${name}`;

const count = 42;
const message = `${count}`;

// ✅ Valid
const greeting = `Hello, ${name}!`;
const fullName = `${first} ${last}`;

Changes

  • Rule implementation: packages/ts/src/rules/unnecessaryTemplateExpressions.ts - visitor on TemplateExpression nodes checking for single span with empty head and tail
  • Tests: packages/ts/src/rules/unnecessaryTemplateExpressions.test.ts - 12 test cases covering variables, function calls, and edge cases
  • Documentation: packages/site/src/content/docs/rules/ts/unnecessaryTemplateExpressions.mdx
  • Plugin registration: Added to packages/ts/src/plugin.ts in alphabetical order
  • Comparisons data: Marked as "status": "implemented" in packages/comparisons/src/data.json
  • Dogfooding: Fixed 2 violations in packages/typescript-language/src/convertTypeScriptDiagnosticToLanguageFileDiagnostic.ts

Rule preset: logical and logicalStrict

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • typescript-eslint.io
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>🚀 Feature: Implement unnecessaryTemplateExpressions rule (TypeScript)</issue_title>
<issue_description>### Feature Request Checklist

Overview

Per flint.fyi/rules, Flint is intended to have a unnecessaryTemplateExpressions rule in the TypeScript plugin (ts). It'll behave roughly equivalently to the existing implementations in other linters to start. This issue tracks adding that rule.

Adding this rule will entail creating the following new source files:

  • packages/ts/src/rules/unnecessaryTemplateExpressions.ts: implementation of the rule itself
  • packages/ts/src/rules/unnecessaryTemplateExpressions.test.ts: tests for the rule
  • packages/site/src/content/docs/rules/ts/unnecessaryTemplateExpressions.mdx: documentation of the rule

Additionally, the following files will need to be edited:

  • packages/comparisons/src/data.json: Comparisons data will need to mention the rule is now "status": "implemented"
  • packages/ts/src/plugin.ts: Included rules should have the new one inserted in alphabetical order

Additional Info

Existing rules in other linters:

❤️‍🔥</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@vercel
Copy link

vercel bot commented Jan 31, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
flint Ready Ready Preview, Comment Feb 1, 2026 9:18pm

Request Review

@changeset-bot
Copy link

changeset-bot bot commented Jan 31, 2026

⚠️ No Changeset found

Latest commit: df2f57d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copilot AI changed the title [WIP] Add unnecessaryTemplateExpressions rule for TypeScript feat: implement unnecessaryTemplateExpressions rule (TypeScript) Feb 1, 2026
Copilot AI requested a review from JoshuaKGoldberg February 1, 2026 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🚀 Feature: Implement unnecessaryTemplateExpressions rule (TypeScript)

2 participants