Skip to content

feat(migrate): some more migration metadata#9016

Merged
dyc3 merged 2 commits intomainfrom
dyc3/more-migrate-meta
Feb 9, 2026
Merged

feat(migrate): some more migration metadata#9016
dyc3 merged 2 commits intomainfrom
dyc3/more-migrate-meta

Conversation

@dyc3
Copy link
Contributor

@dyc3 dyc3 commented Feb 9, 2026

Summary

  • adds a new rule source for noCommonJs
  • adds more metadata for unsupported rules

Test Plan

snapshots, unit tests

Docs

@changeset-bot
Copy link

changeset-bot bot commented Feb 9, 2026

🦋 Changeset detected

Latest commit: 52bc924

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@biomejs/biome Patch
@biomejs/cli-win32-x64 Patch
@biomejs/cli-win32-arm64 Patch
@biomejs/cli-darwin-x64 Patch
@biomejs/cli-darwin-arm64 Patch
@biomejs/cli-linux-x64 Patch
@biomejs/cli-linux-arm64 Patch
@biomejs/cli-linux-x64-musl Patch
@biomejs/cli-linux-arm64-musl Patch
@biomejs/wasm-web Patch
@biomejs/wasm-bundler Patch
@biomejs/wasm-nodejs Patch
@biomejs/backend-jsonrpc Patch

Not sure what this means? Click here to learn what changesets are.

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

@github-actions github-actions bot added A-CLI Area: CLI A-Linter Area: linter L-JavaScript Language: JavaScript and super languages labels Feb 9, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 9, 2026

Walkthrough

The PR introduces migration metadata for ESLint rules by adding a changeset file and registering four new unsupported ESLint rules across multiple sources: func-call-spacing and keyword-spacing for TypeScript, empty-brace-spaces for Unicorn, and func-call-spacing for Vue. Additionally, the no-var-requires rule source is registered with the NoCommonJs lint rule.

Possibly related PRs

Suggested labels

A-CLI, A-Linter, L-JavaScript, A-Tooling

Suggested reviewers

  • ematipico
  • Conaclos
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change as adding migration metadata for ESLint rules, which directly aligns with the changeset and code modifications.
Description check ✅ Passed The description accurately outlines the pull request objectives: adding a new rule source for noCommonJs and extending migration metadata for unsupported rules, matching the actual changes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dyc3/more-migrate-meta

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@crates/biome_js_analyze/src/lint/style/no_common_js.rs`:
- Around line 58-62: Replace the mapping for the TypeScript rule that differs in
coverage: in crates/biome_js_analyze/src/lint/style/no_common_js.rs change the
RuleSource entry RuleSource::EslintTypeScript("no-var-requires").same() to use
.inspired() instead of .same() so that no-var-requires is treated as an inspired
mapping (not identical) to NoCommonJs.

Comment on lines 58 to 62
sources: &[
RuleSource::EslintTypeScript("no-require-imports").same(),
RuleSource::EslintTypeScript("no-var-requires").same(),
RuleSource::EslintImport("no-commonjs").same(),
],
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

@typescript-eslint/no-var-requires rule documentation scope behavior

💡 Result:

@typescript-eslint/no-var-requires flags CommonJS “variable requires”—i.e., assigning the result of require() to a variable:

  • Reported (invalid): var foo = require('foo'), let foo = require('foo'), const foo = require('foo') (the classic “Require statement not part of import statement” message). [1]
  • Allowed (not reported): TypeScript’s import-assignment form import foo = require('foo'), and a side-effect-only require('foo') call (because it’s not a var/let/const assignment). [1]

Scope / what it targets

  • The rule’s scope is specifically require() used in a variable declaration/assignment pattern (“var-requires”), not all require() usage. [1]

Options

  • allow: string[] — a list of regex patterns (compiled with the u flag) for module specifiers that are allowed to be required (commonly used for things like package.json or certain JSON files). Default: []. [1]

Status / replacement

  • The rule is deprecated in favor of @typescript-eslint/no-require-imports. [1]
  • no-require-imports is broader: it disallows invoking require() (optionally allowing import ... = require(...) via allowAsImport). [2]

Sources: [1] no-var-requires docs, typescript-eslint.io; [2] no-require-imports docs, typescript-eslint.io.


🏁 Script executed:

# Check the NoCommonJs rule definition in the file to understand its scope
fd -t f "no_common_js.rs" crates/biome_js_analyze/src/lint/style/

Repository: biomejs/biome

Length of output: 111


🏁 Script executed:

# Read the rule definition to understand what NoCommonJs covers
cat -n crates/biome_js_analyze/src/lint/style/no_common_js.rs | head -100

Repository: biomejs/biome

Length of output: 3961


Use .inspired() instead of .same() for no-var-requires.

@typescript-eslint/no-var-requires only flags require() in variable declarations—it doesn't cover module.exports or exports assignments like NoCommonJs does. Since the coverage differs, .inspired() is the more accurate mapping.

🔧 Suggested fix
-            RuleSource::EslintTypeScript("no-var-requires").same(),
+            RuleSource::EslintTypeScript("no-var-requires").inspired(),
🤖 Prompt for AI Agents
In `@crates/biome_js_analyze/src/lint/style/no_common_js.rs` around lines 58 - 62,
Replace the mapping for the TypeScript rule that differs in coverage: in
crates/biome_js_analyze/src/lint/style/no_common_js.rs change the RuleSource
entry RuleSource::EslintTypeScript("no-var-requires").same() to use .inspired()
instead of .same() so that no-var-requires is treated as an inspired mapping
(not identical) to NoCommonJs.

@codspeed-hq
Copy link

codspeed-hq bot commented Feb 9, 2026

CodSpeed Performance Report

Merging this PR will not alter performance

Comparing dyc3/more-migrate-meta (52bc924) with main (c8dbbbe)

Summary

✅ 58 untouched benchmarks
⏩ 95 skipped benchmarks1

Footnotes

  1. 95 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@dyc3 dyc3 merged commit 9d4cfa3 into main Feb 9, 2026
18 checks passed
@dyc3 dyc3 deleted the dyc3/more-migrate-meta branch February 9, 2026 22:35
@github-actions github-actions bot mentioned this pull request Feb 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CLI Area: CLI A-Linter Area: linter L-JavaScript Language: JavaScript and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants