Skip to content

Can not take JS plugin dependency from shared config #161

@ai

Description

@ai

I believe Zed oxc extensions calls oxlint with a wrong environment (maybe wrong cwd or some env vars), which caused errors in npm dependencies loading error in oxlint.config.ts.

Step by Step

I have shared config @logux/oxc-configs. It has prefer-let rule and shared config’s package has eslint-plugin-prefer-let in dependencies.

When in the project I install this config by:

pnpm add --save-dev @logux/oxc-configs oxlint oxlint-tsgolint typescript
import loguxOxlintConfig from '@logux/oxc-configs/lint'
import { defineConfig } from 'oxlint'

export default defineConfig({
  extends: [loguxOxlintConfig]
})

All Zed inline oxlint issues stop to work.

But oxlint CLI still works:

$ pnpm oxlint

  × typescript-eslint(no-explicit-any): Unexpected `any`. Specify a different type.
   ╭─[index.ts:3:20]
 2 │
 3 │ export const test: any = one;
   ·                    ───
   ╰────
  help: Use `unknown` instead, this will force you to explicitly, and safely, assert the type is correct.

  × prefer-let(prefer-let): `const` declaration for non-constant names at top-level scope. Use `let` or rename to UPPER_CASE
   ╭─[index.ts:1:1]
 1 │ const one = 1;
   · ──────────────
 2 │
   ╰────

Found 0 warnings and 2 errors.
Finished in 152ms on 2 files with 195 rules using 16 threads.

But when I install eslint-plugin-prefer-let directly to the project:

pnpm add --save-dev eslint-plugin-prefer-let

Inline errors (including prefer-let) starts to work.

Reproductions

https://github.com/ai/oxlintconfig-jsplugin-bug

Log

Sorry, because of Zed error, my log is always empty.

But I hope reproduction will be helpful enough.

Zed config

https://github.com/ai/environment/blob/bf3701d1472c265d20d871b2ca75503fdf653a4e/zed.json

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions