Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

@melchor629

Description

@melchor629

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions