feat(migrate): some more migration metadata#9016
Conversation
🦋 Changeset detectedLatest commit: 52bc924 The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
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 |
WalkthroughThe 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
Suggested reviewers
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
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.
| sources: &[ | ||
| RuleSource::EslintTypeScript("no-require-imports").same(), | ||
| RuleSource::EslintTypeScript("no-var-requires").same(), | ||
| RuleSource::EslintImport("no-commonjs").same(), | ||
| ], |
There was a problem hiding this comment.
🧩 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-onlyrequire('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 allrequire()usage. [1]
Options
allow: string[]— a list of regex patterns (compiled with theuflag) for module specifiers that are allowed to be required (commonly used for things likepackage.jsonor certain JSON files). Default:[]. [1]
Status / replacement
- The rule is deprecated in favor of
@typescript-eslint/no-require-imports. [1] no-require-importsis broader: it disallows invokingrequire()(optionally allowingimport ... = require(...)viaallowAsImport). [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 -100Repository: 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 Performance ReportMerging this PR will not alter performanceComparing Summary
Footnotes
|
Summary
noCommonJsTest Plan
snapshots, unit tests
Docs