Skip to content

fix(eslint-plugin) separate legacy and modern dts files #8972

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

Merged
merged 7 commits into from
Apr 8, 2025

Conversation

Newbie012
Copy link
Collaborator

@Newbie012 Newbie012 commented Apr 7, 2025

Aligned the build system with other packages by replacing the custom tsup config with standard modern/legacy build outputs. Moved output files from 'dist' to 'build' directory structure. Removed the patch-missing-export-equals.js script in favor of directly exporting the plugin. Added tsconfig.prod.json for production builds.
Copy link

nx-cloud bot commented Apr 7, 2025

View your CI Pipeline Execution ↗ for commit d2edcce.

Command Status Duration Result
nx affected --targets=test:sherif,test:knip,tes... ❌ Failed 10m 45s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 1m 52s View ↗

☁️ Nx Cloud last updated this comment at 2025-04-08 14:28:49 UTC

@@ -100,8 +100,7 @@
"@tanstack/vue-query": "workspace:*",
"@tanstack/vue-query-devtools": "workspace:*",
"@types/react": "^19.0.1",
"@types/react-dom": "^19.0.2",
"eslint": "$eslint"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to remove that line so I could use a specific version of eslint inside examples. If you have a better idea, please let me know.

@Newbie012 Newbie012 requested a review from Copilot April 7, 2025 16:35
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 9 out of 18 changed files in this pull request and generated no comments.

Files not reviewed (9)
  • examples/react/eslint-legacy/.eslintrc: Language not supported
  • examples/react/eslint-legacy/.gitignore: Language not supported
  • examples/react/eslint-legacy/index.html: Language not supported
  • examples/react/eslint-legacy/package.json: Language not supported
  • examples/react/eslint-legacy/tsconfig.json: Language not supported
  • package.json: Language not supported
  • packages/eslint-plugin-query/package.json: Language not supported
  • packages/eslint-plugin-query/tsconfig.prod.json: Language not supported
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)

examples/react/eslint-legacy/src/index.tsx:51

  • Consider verifying that 'error' is an instance of Error before accessing 'error.message', to prevent potential runtime exceptions if the error structure differs.
<span>Error: {error.message}</span>

@Newbie012
Copy link
Collaborator Author

@TkDodo It seems like there's something off with NX cache

@TkDodo
Copy link
Collaborator

TkDodo commented Apr 7, 2025

the issue appears locally on this PR as well (try running pnpm run build:all) but it doesn’t appear on main, so I think there’s something wrong on this PR

Copy link

pkg-pr-new bot commented Apr 7, 2025

More templates

@tanstack/angular-query-devtools-experimental

npm i https://pkg.pr.new/@tanstack/angular-query-devtools-experimental@8972

@tanstack/angular-query-experimental

npm i https://pkg.pr.new/@tanstack/angular-query-experimental@8972

@tanstack/query-async-storage-persister

npm i https://pkg.pr.new/@tanstack/query-async-storage-persister@8972

@tanstack/query-broadcast-client-experimental

npm i https://pkg.pr.new/@tanstack/query-broadcast-client-experimental@8972

@tanstack/eslint-plugin-query

npm i https://pkg.pr.new/@tanstack/eslint-plugin-query@8972

@tanstack/query-core

npm i https://pkg.pr.new/@tanstack/query-core@8972

@tanstack/query-devtools

npm i https://pkg.pr.new/@tanstack/query-devtools@8972

@tanstack/query-persist-client-core

npm i https://pkg.pr.new/@tanstack/query-persist-client-core@8972

@tanstack/query-sync-storage-persister

npm i https://pkg.pr.new/@tanstack/query-sync-storage-persister@8972

@tanstack/react-query

npm i https://pkg.pr.new/@tanstack/react-query@8972

@tanstack/react-query-devtools

npm i https://pkg.pr.new/@tanstack/react-query-devtools@8972

@tanstack/react-query-next-experimental

npm i https://pkg.pr.new/@tanstack/react-query-next-experimental@8972

@tanstack/react-query-persist-client

npm i https://pkg.pr.new/@tanstack/react-query-persist-client@8972

@tanstack/solid-query

npm i https://pkg.pr.new/@tanstack/solid-query@8972

@tanstack/solid-query-devtools

npm i https://pkg.pr.new/@tanstack/solid-query-devtools@8972

@tanstack/solid-query-persist-client

npm i https://pkg.pr.new/@tanstack/solid-query-persist-client@8972

@tanstack/svelte-query

npm i https://pkg.pr.new/@tanstack/svelte-query@8972

@tanstack/svelte-query-devtools

npm i https://pkg.pr.new/@tanstack/svelte-query-devtools@8972

@tanstack/svelte-query-persist-client

npm i https://pkg.pr.new/@tanstack/svelte-query-persist-client@8972

@tanstack/vue-query

npm i https://pkg.pr.new/@tanstack/vue-query@8972

@tanstack/vue-query-devtools

npm i https://pkg.pr.new/@tanstack/vue-query-devtools@8972

commit: d2edcce

Copy link

github-actions bot commented Apr 7, 2025

Sizes for commit d2edcce:

Branch Bundle Size
Main
This PR

@TkDodo
Copy link
Collaborator

TkDodo commented Apr 7, 2025

there’s a legit error now:

root.tsup.config.js(3,1): error TS6133: 'esbuildPluginFilePathExtensions' is declared but its value is never read.

Copy link

codecov bot commented Apr 8, 2025

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 44.30%. Comparing base (97c8d84) to head (e13738f).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #8972   +/-   ##
=======================================
  Coverage   44.30%   44.30%           
=======================================
  Files         202      202           
  Lines        8058     8058           
  Branches     1784     1785    +1     
=======================================
  Hits         3570     3570           
  Misses       4060     4060           
  Partials      428      428           
Components Coverage Δ
@tanstack/angular-query-devtools-experimental ∅ <ø> (∅)
@tanstack/angular-query-experimental 88.08% <ø> (ø)
@tanstack/eslint-plugin-query 88.19% <0.00%> (ø)
@tanstack/query-async-storage-persister 43.85% <ø> (ø)
@tanstack/query-broadcast-client-experimental ∅ <ø> (∅)
@tanstack/query-codemods 0.00% <ø> (ø)
@tanstack/query-core 94.77% <ø> (ø)
@tanstack/query-devtools 3.61% <ø> (ø)
@tanstack/query-persist-client-core 57.73% <ø> (ø)
@tanstack/query-sync-storage-persister 84.61% <ø> (ø)
@tanstack/react-query 95.42% <ø> (ø)
@tanstack/react-query-devtools 10.00% <ø> (ø)
@tanstack/react-query-next-experimental ∅ <ø> (∅)
@tanstack/react-query-persist-client 100.00% <ø> (ø)
@tanstack/solid-query 78.48% <ø> (ø)
@tanstack/solid-query-devtools ∅ <ø> (∅)
@tanstack/solid-query-persist-client 100.00% <ø> (ø)
@tanstack/svelte-query 88.15% <ø> (ø)
@tanstack/svelte-query-devtools ∅ <ø> (∅)
@tanstack/svelte-query-persist-client 100.00% <ø> (ø)
@tanstack/vue-query 71.01% <ø> (ø)
@tanstack/vue-query-devtools ∅ <ø> (∅)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

"name": "@tanstack/query-example-eslint-legacy",
"private": true,
"type": "module",
"scripts": {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you want this example to be lintend in CI, you need to add a test:eslint script and we’ll have to remove the --exclude here:

"test:eslint": "nx affected --target=test:eslint --exclude=examples/**",

Not sure why examples were excluded, most of them don’t have that task specified anyways 🤷

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, but it seems like something is off with packages that I didn't touch 😅

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah sadly, some tests are flaky. I’ll ship it

…t command

Add `test:eslint` script to react example package.json files to enable linting checks. Update the main `test:eslint` command to remove the exclusion of examples, ensuring linting is applied across the entire project.
@TkDodo TkDodo merged commit 7d3a1a3 into main Apr 8, 2025
4 of 5 checks passed
@TkDodo TkDodo deleted the fix-eslint-plugin-modern-typing branch April 8, 2025 15:14
@thgreasi
Copy link

thgreasi commented Apr 9, 2025

Hi,
I think that this changed the result of require('@tanstack/eslint-plugin-query') from

{
  meta: { name: '@tanstack/eslint-plugin-query' },
  configs: {
    recommended: { plugins: [Array], rules: [Object] },
    'flat/recommended': [ [Object] ]
  },
  rules: {
    'exhaustive-deps': { create: [Function: create], defaultOptions: [], meta: [Object] },
    'stable-query-client': { create: [Function: create], defaultOptions: [], meta: [Object] },
    'no-rest-destructuring': { create: [Function: create], defaultOptions: [], meta: [Object] },
    'no-unstable-deps': { create: [Function: create], defaultOptions: [], meta: [Object] },
    'infinite-query-property-order': { create: [Function: create], defaultOptions: [], meta: [Object] },
    'no-void-query-fn': { create: [Function: create], defaultOptions: [], meta: [Object] }
  }
}

to

{
  default: {
    meta: { name: '@tanstack/eslint-plugin-query' },
    configs: {
      recommended: { plugins: [Array], rules: [Object] },
      'flat/recommended': [ [Object] ]
    },
    rules: {
      'exhaustive-deps': { create: [Function: create], defaultOptions: [], meta: [Object] },
      'stable-query-client': { create: [Function: create], defaultOptions: [], meta: [Object] },
      'no-rest-destructuring': { create: [Function: create], defaultOptions: [], meta: [Object] },
      'no-unstable-deps': { create: [Function: create], defaultOptions: [], meta: [Object] },
      'infinite-query-property-order': { create: [Function: create], defaultOptions: [], meta: [Object] },
      'no-void-query-fn': { create: [Function: create], defaultOptions: [], meta: [Object] }
    }
  },
  plugin: {
    meta: { name: '@tanstack/eslint-plugin-query' },
    configs: {
      recommended: { plugins: [Array], rules: [Object] },
      'flat/recommended': [ [Object] ]
    },
    rules: {
      'exhaustive-deps': { create: [Function: create], defaultOptions: [], meta: [Object] },
      'stable-query-client': { create: [Function: create], defaultOptions: [], meta: [Object] },
      'no-rest-destructuring': { create: [Function: create], defaultOptions: [], meta: [Object] },
      'no-unstable-deps': { create: [Function: create], defaultOptions: [], meta: [Object] },
      'infinite-query-property-order': { create: [Function: create], defaultOptions: [], meta: [Object] },
      'no-void-query-fn': { create: [Function: create], defaultOptions: [], meta: [Object] }
    }
  }
}

I realize that the suggested way to import the package is

import pluginQuery from '@tanstack/eslint-plugin-query'

which if someone is using the TypeScript import helper, it will probably not be an issue at all, but I wanted to raise anyway that the result of the plain commonjs require() calls have changed, just in case it was missed.

@Newbie012
Copy link
Collaborator Author

Thanks, I'll look into it

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

Successfully merging this pull request may close these issues.

ESLint: Failed to load config "plugin:@tanstack/query/recommended" to extend from.
3 participants