Galooshi / atom-import-js

Atom plugin for ImportJS
MIT License
36 stars 3 forks source link

Cmd-shift-J adds duplicate imports when they don't match settings exactly #8

Closed dcporter closed 7 years ago

dcporter commented 7 years ago

I'm in Atom, with v0.3.0 of atom-import-js with the default settings (via no settings file). I'm able to get cmd-shift-J to reliably insert duplicate imports if the import that's already present either ends with a semicolon, or has the file extension in it.

I'm in a file like this, with a sibling file AppView.js which exports AppView:

import AppView from './AppView'

const Test = AppView;

If I cursor over AppView in line 3 and hit cmd-shift-J, I end up with this:

import AppView from './AppView';

import AppView from './AppView'

const Abc = AppView;

Same with importing from ./AppView.js. If I match the expectations from the default settings and provide import AppView from './AppView'; then it works correctly.

trotzig commented 7 years ago

Thanks for the report @dcporter! I can confirm that this is a bug in the main import-js project so I moved the bug: https://github.com/Galooshi/import-js/issues/352