Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Unable to migrate ESLint configuration that extends @vercel/style-guide/eslint to Biome #4528

Closed
1 task done
maronnjapan opened this issue Nov 13, 2024 · 7 comments · Fixed by #4538
Closed
1 task done
Assignees
Labels
A-CLI Area: CLI S-Bug-confirmed Status: report has been confirmed as a valid bug

Comments

@maronnjapan
Copy link

Environment information

CLI:
  Version:                      1.9.5-nightly.4713c52
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           linux

Environment:
  BIOME_LOG_PATH:               unset
  BIOME_LOG_PREFIX_NAME:        unset
  BIOME_CONFIG_PATH:            unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v20.11.1"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "npm/10.2.4"

Biome Configuration:
  Status:                       Loaded successfully
  Formatter disabled:           false
  Linter disabled:              false
  Organize imports disabled:    false
  VCS disabled:                 true

Workspace:
  Open Documents:               0

What happened?

What I Want to Achieve

I want to migrate my ESLint configuration that uses @vercel/style-guide to Biome.

Current Issue

For testing the migration from ESLint to Biome configuration, I created a simple .eslintrc.js as follows:

module.exports = {
  extends: "@vercel/style-guide/eslint/browser",
};

Then, I tried to migrate the ESLint configuration to Biome by running npx biome migrate eslint --write --include-inspired, but encountered the following error and couldn't complete the migration:

migrate ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  ✖ Migration has encountered an error: `node` was invoked to resolve '@vercel/eslint-config-style-guide/eslint/browser'. This invocation failed with the following error:
    node:internal/modules/esm/resolve:853
      throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), null);
            ^
    
    Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@vercel/eslint-config-style-guide' imported from /var/www/biome-test/[eval]
        at packageResolve (node:internal/modules/esm/resolve:853:9)
        at moduleResolve (node:internal/modules/esm/resolve:910:20)
        at defaultResolve (node:internal/modules/esm/resolve:1130:11)
        at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:396:12)
        at ModuleLoader.resolve (node:internal/modules/esm/loader:365:25)
        at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:240:38)
        at ModuleLoader.import (node:internal/modules/esm/loader:328:34)
        at importModuleDynamically (node:internal/process/execution:96:29)
        at importModuleDynamicallyWrapper (node:internal/vm/module:431:21)
        at importModuleDynamicallyCallback (node:internal/modules/esm/utils:207:14) {
      code: 'ERR_MODULE_NOT_FOUND'
    }
    
    Node.js v20.11.1

What I've Tried

Thinking there might be an issue with the .eslintrc.js format, I replaced it with the following and ran the migration command again:

module.exports = {
  extends: "eslint:recommended",
};

This time, the migration completed successfully.

Additionally, I noticed that a similar issue was reported in #3709, so I tried installing version 1.9.5-nightly.4713c52 which includes fixes for the reported issue.
However, running the migration command still resulted in the same error, and the migration failed.

Based on these attempts, I suspect that the migration fails when @vercel/style-guide is used in the extends field, but I'm not sure how to resolve this issue.

If anyone knows how to fix this, I would greatly appreciate your help.

Expected result

I want to migrate an ESLint configuration that extends @vercel/style-guide/eslint to Biome.

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@maronnjapan maronnjapan added the S-Needs triage Status: this issue needs to be triaged label Nov 13, 2024
@Conaclos
Copy link
Member

Have you installed @vercel/style-guide/eslint/browser?

@maronnjapan
Copy link
Author

maronnjapan commented Nov 13, 2024

Thank you for checking.
Yes, I have @vercel/style-guide/eslint/browser installed.
I installed @vercel/style-guide in my project using the npm command, and I've also confirmed that node_modules/@vercel/style-guide/eslint/browser.js exists.

@Conaclos
Copy link
Member

Have you the same error when you run node .eslintrc.js?

@maronnjapan
Copy link
Author

When I ran node .eslintrc.js, no errors occurred.

@Conaclos
Copy link
Member

The issue comes from the fact that @vercel/style-guide is not a conventional name for ESLint config. Biome tries to load @vercel/eslint-config-style-guide instead of @vercel/style-guide.

@Conaclos Conaclos added A-CLI Area: CLI S-Bug-confirmed Status: report has been confirmed as a valid bug and removed S-Needs triage Status: this issue needs to be triaged labels Nov 14, 2024
@Conaclos
Copy link
Member

#4538 will fix your issue. However, we will encounter another issue with a known workaround explained in this comment.

@Conaclos Conaclos self-assigned this Nov 14, 2024
@maronnjapan
Copy link
Author

I apologize for my delayed confirmation.
Based on the issue you shared, I commented out require('@rushstack/eslint-patch/modern-module-resolution') in @vercel/style-guide and ran npx biome migrate eslint --write --include-inspired, which resolved the error.
Therefore, once your implemented changes are reflected, my issue should be resolved.
I'm looking forward to the release.
Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-CLI Area: CLI S-Bug-confirmed Status: report has been confirmed as a valid bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants