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

undefined second parameter crashes solid/no-react-deps #111

Closed
1 task
moorejs opened this issue Nov 14, 2023 · 1 comment · Fixed by #120
Closed
1 task

undefined second parameter crashes solid/no-react-deps #111

moorejs opened this issue Nov 14, 2023 · 1 comment · Fixed by #120
Assignees
Labels
bug Something isn't working

Comments

@moorejs
Copy link

moorejs commented Nov 14, 2023

Describe the bug

When I use undefined as my initial value for createEffect, eslint crashes in rule solid/no-react-deps.

To Reproduce

createEffect((previousValue) => {
  // logic uses previousValue which is initially undefined
}, undefined)

Expected behavior

The plugin does not crash.
The warning does not apply.

Environment (please complete the following information):

  • OS: macOS 14.1
  • Node version (node --version): 20.5.1
  • eslint-plugin-solid version (npm list eslint-plugin-solid/yarn why eslint-plugin-solid): 0.13.0
  • eslint version (npm list eslint/yarn why eslint): 8.53.0

Additional context

Stack trace points to the trace function.

Rule: "solid/no-react-deps"
    at trace (.../node_modules/.pnpm/eslint-plugin-solid@0.13.0_eslint@8.53.0_typescript@5.2.2/node_modules/eslint-plugin-solid/dist/utils.js:53:21)
    at .../node_modules/.pnpm/eslint-plugin-solid@0.13.0_eslint@8.53.0_typescript@5.2.2/node_modules/eslint-plugin-solid/dist/rules/no-react-deps.js:29:88
    at Array.map (<anonymous>)
    at CallExpression (.../node_modules/.pnpm/eslint-plugin-solid@0.13.0_eslint@8.53.0_typescript@5.2.2/node_modules/eslint-plugin-solid/dist/rules/no-react-deps.js:29:57)
    at ruleErrorHandler (.../node_modules/.pnpm/eslint@8.53.0/node_modules/eslint/lib/linter/linter.js:1091:28)
    at .../node_modules/.pnpm/eslint@8.53.0/node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (.../node_modules/.pnpm/eslint@8.53.0/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (.../node_modules/.pnpm/eslint@8.53.0/node_modules/eslint/lib/linter/node-event-generator.js:297:26)
    at NodeEventGenerator.applySelectors (.../node_modules/.pnpm/eslint@8.53.0/node_modules/eslint/lib/linter/node-event-generator.js:326:22)
  • I would be willing to contribute a PR to fix this issue
@moorejs moorejs added the bug Something isn't working label Nov 14, 2023
@joshwilsonvu
Copy link
Collaborator

Screenshot 2023-12-30 at 12 32 54 PM

Apparently undefined is parsed as an identifier, not a literal (like null and others) 😭 no matter how much I work with JavaScript it still manages to surprise me sometimes!

I'll just need to add a check in trace. Thanks for the issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants