wix-incubator / vscode-glean

The extension provides refactoring tools for your React codebase
MIT License
1.46k stars 56 forks source link

Incorrect handling of nested function params #96

Open borislit opened 4 years ago

borislit commented 4 years ago

Blocked By: https://github.com/wix/vscode-glean/issues/97

Example:

class Foo extends Component {

  render() {
    return (<div>
      {this.props.foo.map((bar) => <div>{bar.x}</div>)}
    </div>)
  }
}

Current:

 const Foo = props => {
   const foo = useRef();
   const x = useRef();
   return <div>
       {foo.current.map(bar => <div>{x.current}</div>)}
     </div>;
 };

Expected:

const Foo = props => {
  return <div>
      {props.foo.current.map(bar => <div>{bar.x}</div>)}
    </div>;
};