solidjs-community / eslint-plugin-solid

Solid-specific linting rules for ESLint.
MIT License
209 stars 24 forks source link

Fixing "solid/reactivity" rule in component props removes type annotation #58

Closed micnic closed 1 year ago

micnic commented 1 year ago

Describe the bug When calling fix issue for "solid/reactivity" in component props with type annotation the type annotation gets removed.

To Reproduce

type Props = {
  prop1: string;
  prop2: number;
};

const MyComponent = ({ prop1, prop2 }: Props) => { // Reactivity issue error
  return (
    <div>{prop1} {prop2}</div>
  );
};

Expected behavior

type Props = {
  prop1: string;
  prop2: number;
};

const MyComponent = (props: Props) => { // Type annotation should be kept
  return (
    <div>{props.prop1} {props.prop2}</div>
  );
};

Actual behavior

type Props = { // Types unused :(
  prop1: string;
  prop2: number;
};

const MyComponent = (props) => { // Type annotation is removed
  return (
    <div>{props.prop1} {props.prop2}</div>
  );
};
joshwilsonvu commented 1 year ago

Thanks so much for the quality bug report! Fixed in v0.9.3.

micnic commented 1 year ago

Thank you for fixing it!