Galooshi/vim-import-js

doesn't detect undeclared React components

mvolkmann opened this issue · 4 comments

I was hoping that if I had something like in JSX of a file in a React app, this would find the file in my project that defines it and add an import for it. Any chance that will be implemented soon?

It should, as long as the filename matches the component name, and as long as you have eslint configured in your project to detect undefined variables in JSX.

Or maybe I am misunderstanding your situation? Can you give us an example?

Maybe the issue is the file naming. If I have a component named FooBar, it is in a file named foo-bar.js. I assumed it would look in the files to see which components they define.

It isn't smart enough to look at which components are defined, but it does do some fuzzy matching of filenames. I believe that FooBar should be able to be mapped to foo-bar.js.

I'm not sure if there is anything else to do here, so I'm closing this out. Feel free to reopen it!