Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions .changeset/proud-lemons-wonder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@biomejs/biome": patch
---

Added eslint migration metadata for the rules `@typescript/no-var-requires`, `@typescript/keyword-spacing`, `@typescript/func-call-spacing`, `vue/keyword-spacing`, `vue/func-call-spacing`, and `unicorn/empty-brace-spaces`,

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions crates/biome_cli/src/execute/migrate/unsupported_rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,9 @@ pub const UNSUPPORTED_RULES: &[UnsupportedRule] = &[
UnsupportedRule(EslintTypeScript("brace-style"), Stylistic),
UnsupportedRule(EslintTypeScript("comma-dangle"), Stylistic),
UnsupportedRule(EslintTypeScript("comma-spacing"), FormatterCovers),
UnsupportedRule(EslintTypeScript("func-call-spacing"), FormatterCovers),
UnsupportedRule(EslintTypeScript("indent"), FormatterOption("indentWidth")),
UnsupportedRule(EslintTypeScript("keyword-spacing"), FormatterCovers),
UnsupportedRule(EslintTypeScript("no-extra-parens"), FormatterCovers),
UnsupportedRule(EslintTypeScript("no-extra-semi"), FormatterCovers),
UnsupportedRule(EslintTypeScript("object-curly-spacing"), FormatterCovers),
Expand All @@ -259,6 +261,7 @@ pub const UNSUPPORTED_RULES: &[UnsupportedRule] = &[
UnsupportedRule(EslintTypeScript("space-before-blocks"), FormatterCovers),
UnsupportedRule(EslintTypeScript("space-before-function-paren"), Stylistic),
UnsupportedRule(EslintTypeScript("space-infix-ops"), FormatterCovers),
UnsupportedRule(EslintUnicorn("empty-brace-spaces"), FormatterCovers),
UnsupportedRule(EslintVueJs("array-bracket-newline"), FormatterCovers),
UnsupportedRule(EslintVueJs("array-bracket-spacing"), FormatterCovers),
UnsupportedRule(EslintVueJs("array-element-newline"), FormatterCovers),
Expand All @@ -271,6 +274,7 @@ pub const UNSUPPORTED_RULES: &[UnsupportedRule] = &[
UnsupportedRule(EslintVueJs("comma-style"), Stylistic),
UnsupportedRule(EslintVueJs("dot-location"), Stylistic),
UnsupportedRule(EslintVueJs("first-attribute-linebreak"), Stylistic),
UnsupportedRule(EslintVueJs("func-call-spacing"), FormatterCovers),
UnsupportedRule(EslintVueJs("html-closing-bracket-newline"), Stylistic),
UnsupportedRule(EslintVueJs("html-closing-bracket-spacing"), Stylistic),
UnsupportedRule(EslintVueJs("html-comment-content-newline"), Stylistic),
Expand Down
1 change: 1 addition & 0 deletions crates/biome_js_analyze/src/lint/style/no_common_js.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ declare_lint_rule! {
language: "js",
sources: &[
RuleSource::EslintTypeScript("no-require-imports").same(),
RuleSource::EslintTypeScript("no-var-requires").same(),
RuleSource::EslintImport("no-commonjs").same(),
],
Comment on lines 58 to 62
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.

recommended: false,
Expand Down