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

reactivity does not accept default or initial as names #151

Closed
1 task done
N0tExisting opened this issue Aug 28, 2024 · 2 comments · Fixed by #152
Closed
1 task done

reactivity does not accept default or initial as names #151

N0tExisting opened this issue Aug 28, 2024 · 2 comments · Fixed by #152
Assignees
Labels
bug Something isn't working

Comments

@N0tExisting
Copy link
Contributor

Describe the bug

When trying to initialize state from props named default or initiall, an error is shown.

To Reproduce

import { createSignal, type FlowProps } from 'solid-js';

export type FailProps = Props<{ default: number, initial: string }>;

export default function Failure(p: FailProps) {
  createSignal(props.default)
  createSignal(props.initial)
}

Expected behavior

No Error is shown.

Environment (please complete the following information):

  • OS: Ubuntu Server 22
  • Node version: v20.11.0
  • eslint-plugin-solid version: 0.14.2
  • eslint version: 8.57.0

Additional context

I think this might be intentional, but I couldn't find anything to prove that.

  • I would be willing to contribute a PR to fix this issue
@N0tExisting N0tExisting added the bug Something isn't working label Aug 28, 2024
@joshwilsonvu
Copy link
Collaborator

https://github.com/solidjs-community/eslint-plugin-solid/blob/main/packages/eslint-plugin-solid/src/rules/reactivity.ts#L578

I wouldn't mind if you changed the regex there to accept initial or default, that's fine! I don't think we should static on its own though, as it really does need to be a prefix to make sense.

@N0tExisting
Copy link
Contributor Author

yeah, it would be useful if @once would work on types:

export interface MyProps {
  /** @once */
  staticThing: string;
}

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