Skip to content

solid/reactivity hardcodes the assumption that solid primitives are imported from "solid-js" #183

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

Open
1 task done
Alloyed opened this issue Apr 10, 2025 · 0 comments
Open
1 task done
Assignees
Labels
enhancement New feature or request

Comments

@Alloyed
Copy link

Alloyed commented Apr 10, 2025

Describe the need
semi-related to: solidjs/solid-refresh#44
In our codebase, we use a universal renderer that explicitly skips the web-specific features present in "solid-js". this means, instead of writing import {createSignal} from 'solid-js', we write import {createSignal} from 'my-custom-solid-renderer';

This kind of accidentally worked in earlier versions of eslint-plugin-solid, but it seems that in-between 0.13.2 and 0.14.5, the symbol detection got more strict, leading to many more false negatives.

Suggested Solution
some kind of config option to specify the import path, eg. solidImportPattern: /^my-custom-solid-renderer/
this would involve adding a parameter to the trackImports() method and adding this config flag to every rule that uses it. (I don't know eslint that well, but if this could be a global parser flag ala the tsconfig that would probably be better)

https://github.com/solidjs-community/eslint-plugin-solid/blob/main/packages/eslint-plugin-solid/src/utils.ts#L149

Possible Alternatives
the upstream solid package could be refactored to not be web-specific, or for the reactive pieces to exist in their own library (solidjs/solid#2051). i think this is already happening for solid 2.

we could remove the requirement altogether that imports come from the solid-js library, but i think that would be worse for all other users.

  • I would be willing to contribute a PR to implement this feature
@Alloyed Alloyed added the enhancement New feature or request label Apr 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants