Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 31, 2026

Implements unnecessaryUseStricts rule to detect and remove redundant "use strict" directives in ES modules, where strict mode is automatically enabled.

// ❌ Unnecessary in modules
"use strict";

export function calculate(value: number) {
    return value * 2;
}

// ✅ Correct
export function calculate(value: number) {
    return value * 2;
}

Changes

  • Rule implementation (packages/ts/src/rules/unnecessaryUseStricts.ts)

    • Detects "use strict" directives at the start of ES modules
    • Provides autofix that removes the directive including trailing whitespace
    • Only triggers for files with import/export statements (ts.isExternalModule)
  • Tests (packages/ts/src/rules/unnecessaryUseStricts.test.ts)

    • Validates detection in various module patterns
    • Confirms non-modules are allowed to keep "use strict"
    • Tests consecutive line handling and whitespace removal
  • Documentation (packages/site/src/content/docs/rules/ts/unnecessaryUseStricts.mdx)

    • Explains ES module strict mode behavior
    • Provides MDN references
  • Integration

    • Added to packages/ts/src/plugin.ts (alphabetical order)
    • Marked as implemented in packages/comparisons/src/data.json
    • Updated cspell.json with new terms

Equivalent to Biome's noRedundantUseStrict rule.

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:

  • biomejs.dev
    • 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)
  • telemetry.astro.build
    • Triggering command: /opt/hostedtoolcache/node/24.13.0/x64/bin/node node /home/REDACTED/work/flint/flint/packages/site/node_modules/.bin/../astro/astro.js sync git conf�� get --local node credential.userngit aKGoldberg@usersrev-parse (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 unnecessaryUseStricts rule (TypeScript)</issue_title>
<issue_description>### Feature Request Checklist

Overview

Per flint.fyi/rules, Flint is intended to have a unnecessaryUseStricts 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/unnecessaryUseStricts.ts: implementation of the rule itself
  • packages/ts/src/rules/unnecessaryUseStricts.test.ts: tests for the rule
  • packages/site/src/content/docs/rules/ts/unnecessaryUseStricts.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)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@changeset-bot
Copy link

changeset-bot bot commented Jan 31, 2026

⚠️ No Changeset found

Latest commit: 23b4e6a

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

@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 Jan 31, 2026 11:36pm

Request Review

Copilot AI changed the title [WIP] Add unnecessaryUseStricts rule for TypeScript plugin feat: implement unnecessaryUseStricts rule for TypeScript plugin Jan 31, 2026
Copilot AI requested a review from JoshuaKGoldberg January 31, 2026 23:35
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 unnecessaryUseStricts rule (TypeScript)

2 participants