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

Extension fails when config imports via tsx or jiti #1923

Open
RebeccaStevens opened this issue Aug 26, 2024 · 4 comments
Open

Extension fails when config imports via tsx or jiti #1923

RebeccaStevens opened this issue Aug 26, 2024 · 4 comments
Labels
info-needed Issue requires more information from poster

Comments

@RebeccaStevens
Copy link

Config files like the following result in the extension erroring. Running eslint via the cli work fine.

import { tsImport } from "tsx/esm/api";

const local = await tsImport("./src/index.ts", import.meta.url).then(
  (r) => r.default,
);

const configs = [
  // ...
);

// Use our local version of the plugin.
for (const config of configs) {
  if (config?.plugins?.["my-plugin"] !== undefined) {
    config.plugins["my-plugin"] = local;
  }
}

export default configs;

Output:

[Info ] ESLint server is starting.
[Info ] ESLint server running in node v20.14.0
[Info ] ESLint server is running.
[Info ] ESLint library loaded from: /path/to/project/node_modules/.pnpm/[email protected]/node_modules/eslint/lib/api.js
[Error] An unexpected error occurred:
[Error] TransformError: Cannot read properties of undefined (reading 'size')
    at normalizeSpawnArguments (node:child_process:726:34)
    at Object.spawn (node:child_process:792:13)
    at ensureServiceIsRunning (/path/to/project/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1975:29)
    at transform (/path/to/project/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1875:37)
    at file:///path/to/project/node_modules/.pnpm/[email protected]/node_modules/tsx/dist/index-DeKCL_WS.mjs:16:2654
    at applyTransformers (file:///path/to/project/node_modules/.pnpm/[email protected]/node_modules/tsx/dist/index-DeKCL_WS.mjs:16:1266)
    at transform (file:///path/to/project/node_modules/.pnpm/[email protected]/node_modules/tsx/dist/index-DeKCL_WS.mjs:16:2601)
    at load (file:///path/to/project/node_modules/.pnpm/[email protected]/node_modules/tsx/dist/esm/index.mjs?1724634499253:2:2245)
    at async nextLoad (node:internal/modules/esm/hooks:866:22)
    at async Hooks.load (node:internal/modules/esm/hooks:449:20)
@dbaeumer
Copy link
Member

@RebeccaStevens can you please provide me with a GitHub repository I can clone that contains a minimal setup demoing the problem. This can be caused by many things and without a good reproducible case it is hard to say why it fails.

@dbaeumer dbaeumer added the info-needed Issue requires more information from poster label Aug 26, 2024
@RebeccaStevens
Copy link
Author

@dbaeumer Here's a non-minimal repo: https://github.com/eslint-functional/eslint-plugin-functional

I can make a minimal version later when I get some time.

@dbaeumer
Copy link
Member

@RebeccaStevens I cloned the repository you provided but I already fail with some initialization steps. So a minimal version is highly appreciated.

@dbaeumer
Copy link
Member

After running pnpm build things started to load. However ESLint works for me as expected

image

Appreciate a minimal version with steps on how to reproduce what you are seeing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

5 participants
@dbaeumer @RebeccaStevens and others