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

eslint plugin in latest beta tries to require files that do not exist #5795

Closed
melchor629 opened this issue Jul 28, 2023 · 6 comments
Closed

Comments

@melchor629
Copy link

Describe the bug

In the latest beta of @tanstack/eslint-plugin-query (version 5.0.0-beta.0), eslint fails with the following error:

Error: Failed to load plugin '@tanstack/eslint-plugin-query' declared in '.eslintrc.yaml': Cannot find module './configs.cjs'
Require stack:
- ...\node_modules\@tanstack\eslint-plugin-query\build\legacy\index.cjs
- ...\node_modules\@eslint\eslintrc\dist\eslintrc.cjs
Referenced from: ...\.eslintrc.yaml
    at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
    at Module._load (node:internal/modules/cjs/loader:922:27)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Object.<anonymous> (...\node_modules\@tanstack\eslint-plugin-query\build\legacy\index.cjs:27:22)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19)

Inspecting the package, I see that around lines 27 and 28 of build/legacy/index.cjs there are these require lines:

var import_configs = require("./configs.cjs");
var import_rules = require("./rules.cjs");

But those files do not exist in the package:
image

capture from https://www.npmjs.com/package/@tanstack/eslint-plugin-query/v/5.0.0-beta.0?activeTab=code

Your minimal, reproducible example

https://codesandbox.io/p/sandbox/gifted-kare-2tfllj

Steps to reproduce

  1. Create a npm package
  2. Install eslint and @tanstack/eslint-plugin-query
  3. (optional) Configure TypeScript
  4. Configure eslint with something minimal like extends: [ 'plugin:@tanstack/eslint-plugin-query/recommended' ]
  5. Put some js/ts file somewhere
  6. Try to lint the file with eslint

Expected behavior

eslint does not crash when using @tanstack/eslint-plugin-query configuration or plugin.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

  • OS: Windows
  • Platform: node v18.17.0

Tanstack Query adapter

None

TanStack Query version

5.0.0-beta.0

TypeScript version

No response

Additional context

No response

@TkDodo
Copy link
Collaborator

TkDodo commented Jul 28, 2023

@lachlancollins can you take a look at this please?

@lachlancollins
Copy link
Member

I think this is a regression from #5751, however it has an easy fix :)

@TkDodo TkDodo closed this as completed Jul 28, 2023
@melchor629
Copy link
Author

melchor629 commented Jul 31, 2023

Hello again, I think the fix is not complete. I just tried the 5.0.0-beta.5 and it still fails with the same error. But this time, at least there are the configs and rules folders.
image

The imports in the file (edit: to clarify, this file build/legacy/index.cjs) are the same as originally wrote in the issue.

Should I create a new issue for that?

@TkDodo TkDodo reopened this Jul 31, 2023
@TkDodo
Copy link
Collaborator

TkDodo commented Jul 31, 2023

I've reopened this issue, @lachlancollins please have another look

@lachlancollins
Copy link
Member

@melchor629 could you please try the latest release (v5.0.0-beta.10)?

@melchor629
Copy link
Author

@lachlancollins working fine with 5.0.0-beta.10 👍

Thanks for taking a look at the issue. Closing it as it is now working as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants