{"action":"opened","issue":{"url":"https://api.github.com/repos/nkt/atom-autocomplete-modules/issues/101","repository_url":"https://api.github.com/repos/nkt/atom-autocomplete-modules","labels_url":"https://api.github.com/repos/nkt/atom-autocomplete-modules/issues/101/labels{/name}","comments_url":"https://api.github.com/repos/nkt/atom-autocomplete-modules/issues/101/comments","events_url":"https://api.github.com/repos/nkt/atom-autocomplete-modules/issues/101/events","html_url":"https://github.com/nkt/atom-autocomplete-modules/issues/101","id":324161887,"number":101,"title":"Lookups are assuming source file is CJS when actually ES6, under certain conditions","user":{"login":"jonboiser","id":10248067,"avatar_url":"https://avatars2.githubusercontent.com/u/10248067?v=4","gravatar_id":"","url":"https://api.github.com/users/jonboiser","html_url":"https://github.com/jonboiser","followers_url":"https://api.github.com/users/jonboiser/followers","following_url":"https://api.github.com/users/jonboiser/following{/other_user}","gists_url":"https://api.github.com/users/jonboiser/gists{/gist_id}","starred_url":"https://api.github.com/users/jonboiser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonboiser/subscriptions","organizations_url":"https://api.github.com/users/jonboiser/orgs","repos_url":"https://api.github.com/users/jonboiser/repos","events_url":"https://api.github.com/users/jonboiser/events{/privacy}","received_events_url":"https://api.github.com/users/jonboiser/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-17T19:51:23Z","updated_at":"2018-05-17T19:51:23Z","closed_at":null,"author_association":"NONE","body":"### Description\r\n\r\nIf I have files in this structure:\r\n\r\n```\r\n.\r\n├── lib.js\r\n├── main\r\n│   └── main.js\r\n└── main.js\r\n\r\n```\r\n\r\nWhere all of the JS files use ES6 import, attempting to import a named export in `foo.js` from within the nested `main/main.js` does not work since it is falling into the the `lookupCommonJS` utility (https://github.com/nkt/atom-autocomplete-modules/blob/master/src/utils/export-module-completion.js#L86) and fails because of the `import` keywords in `foo.js`\r\n\r\nOstensibly, `foo.js` should be handled as an ES6 module.\r\n\r\nHowever, doing the same thing from the unnested `main.js` does not have this problem.\r\n\r\n### Steps to Reproduce\r\n\r\n1. Clone this repo https://github.com/jonboiser/simple-repo/\r\n2. In https://github.com/jonboiser/simple-repo/blob/master/main/main.js, attempt to get an autocompletion for named export `foo`\r\n3. Get the Error in the console\r\n\r\nConversely, try the same thing on this file:\r\n\r\nhttps://github.com/jonboiser/simple-repo/blob/master/main.js\r\n\r\nAnd get the expected behavior.\r\n\r\n**Expected behavior:** [What you expect to happen]\r\n\r\nNo error in the console; get autocompletion suggestion in buffer\r\n\r\n**Actual behavior:** [What actually happens]\r\n\r\nError in the console; no autocompletion suggestion in buffer\r\n\r\n**Reproduces how often:** [What percentage of the time does it reproduce?]\r\n\r\n100%\r\n\r\n#### Console errors\r\n\r\n```\r\n// /Users/jon/github/simple-repo/lib.js:1 Uncaught (in promise) SyntaxError: Unexpected token export\r\n//     at Module.get_Module._compile (/Applications/Atom.app/Contents/Resources/app/src/native-compile-cache.js:94:52)\r\n//     at Object.value [as .js] (/Applications/Atom.app/Contents/Resources/app/src/compile-cache.js:240:29)\r\n//     at Module.load (module.js:488:32)\r\n//     at tryModuleLoad (module.js:447:12)\r\n//     at Function.Module._load (module.js:439:3)\r\n//     at Module.require (file:///Applications/Atom.app/Contents/Resources/app.asar/static/index.js:47:45)\r\n//     at require (/Applications/Atom.app/Contents/Resources/app/src/native-compile-cache.js:66:33)\r\n//     at lookupCommonJs (/Users/jon/.atom/packages/autocomplete-modules/src/utils/export-module-completion.js:88:23)\r\n//     at parseFile.then.catch (/Users/jon/.atom/packages/autocomplete-modules/src/utils/export-module-completion.js:82:14)\r\n//     at <anonymous>\r\n\r\n\r\n```\r\n\r\n### Versions\r\n\r\n```\r\napm  1.19.0\r\nnpm  3.10.10\r\nnode 6.9.5 x64\r\natom 1.27.0\r\npython 3.6.5\r\ngit 2.15.1\r\n```\r\n\r\nmacOS 10.13.14\r\n\r\n### Additional Information\r\n\r\nAny additional information, configuration or data that might be necessary to reproduce the issue.\r\n"}}
{"actor":{"display_login":"jonboiser"}}