eslint-plugin-panda icon indicating copy to clipboard operation
eslint-plugin-panda copied to clipboard

Time-out issues after setting eslint rules

Open sjaakbanaan opened this issue 10 months ago • 7 comments
trafficstars

I tried installing this eslint plugin today: "@pandacss/eslint-plugin": "^0.2.3",

I added the plugin like this in my eslint config:

"plugins": [
    ...
    "@pandacss"
  ],

And then as soon as i add rules and restart my ESLint server, i get:

 Error: Stopping the server timed out
    at /Users/username/.vscode/extensions/dbaeumer.vscode-eslint-3.0.10/client/out/extension.js:1:98293
    at b.restart (/Users/username/.vscode/extensions/dbaeumer.vscode-eslint-3.0.10/client/out/extension.js:1:271060)
 

And ESLint no longer works.

These are the rules i added:

    "@pandacss/no-config-function-in-source": "error",
    "@pandacss/no-debug": "error",
    "@pandacss/no-dynamic-styling": "error",
    "@pandacss/no-hardcoded-color": "error",
    "@pandacss/no-invalid-token-paths": "error",
    "@pandacss/no-invalid-nesting": "error",
    "@pandacss/no-property-renaming": "error",
    "@pandacss/no-unsafe-token-fn-usage": "error",

Any idea what's going on here? Thanks.

sjaakbanaan avatar Jan 10 '25 13:01 sjaakbanaan

This appears to be a major issue.

@anubra266 do you have a clue on what's the bottleneck?

gajus avatar Feb 03 '25 18:02 gajus

This appears to be a major issue.

@anubra266 do you have a clue on what's the bottleneck?

@gajus I've not encountered this, but I'll see if I can reproduce later in the evening. Any more helpful errors from your editor logs would be helpful BTW

anubra266 avatar Feb 03 '25 18:02 anubra266

Will spend some time debugging this today, but when I attempt to use this plugin in our project, ESLint goes entirely to a halt.

gajus avatar Feb 03 '25 18:02 gajus

Rule                               | Time (ms) | Relative
:----------------------------------|----------:|--------:
@pandacss/file-not-included        |  9434.809 |    14.8%
@pandacss/no-unsafe-token-fn-usage |  5100.427 |     8.0%
@pandacss/no-hardcoded-color       |  4944.562 |     7.7%
@pandacss/no-invalid-token-paths   |  4529.854 |     7.1%
@pandacss/no-dynamic-styling       |  4224.377 |     6.6%
@pandacss/no-property-renaming     |  3183.236 |     5.0%
prettier/prettier                  |  3147.218 |     4.9%

Just tried again. If you run eslint with TIMING=1, every single panda rule shows up with massive latency.

gajus avatar Feb 07 '25 22:02 gajus

I didn't validate this, but I am 80% sure that the reason for this is because the current implementation does not cache the results of:

const isFileIncluded = isValidFile(context)

and

isPandaImport(node, context)

gajus avatar Feb 07 '25 22:02 gajus

@anubra266 I will happily submit a PR if that's the blocker here.

gajus avatar Feb 11 '25 04:02 gajus

@gajus Feel free to open a PR

anubra266 avatar Feb 11 '25 06:02 anubra266