{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/23287","repository_url":"https://api.github.com/repos/Microsoft/TypeScript","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/23287/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/23287/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/23287/events","html_url":"https://github.com/Microsoft/TypeScript/issues/23287","id":312685278,"number":23287,"title":"Organize imports removes react imports in js projects that don't configure \"jsx\"","user":{"login":"mjbvz","id":12821956,"avatar_url":"https://avatars2.githubusercontent.com/u/12821956?v=4","gravatar_id":"","url":"https://api.github.com/users/mjbvz","html_url":"https://github.com/mjbvz","followers_url":"https://api.github.com/users/mjbvz/followers","following_url":"https://api.github.com/users/mjbvz/following{/other_user}","gists_url":"https://api.github.com/users/mjbvz/gists{/gist_id}","starred_url":"https://api.github.com/users/mjbvz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mjbvz/subscriptions","organizations_url":"https://api.github.com/users/mjbvz/orgs","repos_url":"https://api.github.com/users/mjbvz/repos","events_url":"https://api.github.com/users/mjbvz/events{/privacy}","received_events_url":"https://api.github.com/users/mjbvz/received_events","type":"User","site_admin":false},"labels":[{"id":113970366,"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/Bug","name":"Bug","color":"e11d21","default":false},{"id":303278716,"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/Domain:%20JSX/TSX","name":"Domain: JSX/TSX","color":"207de5","default":false},{"id":881839516,"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/Domain:%20Organize%20Imports","name":"Domain: Organize Imports","color":"c2e0c6","default":false},{"id":487610139,"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/Domain:%20Quick%20Fixes","name":"Domain: Quick Fixes","color":"d4c5f9","default":false},{"id":263347516,"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/Salsa","name":"Salsa","color":"ff4b20","default":false}],"state":"open","locked":false,"assignee":{"login":"amcasey","id":10508071,"avatar_url":"https://avatars2.githubusercontent.com/u/10508071?v=4","gravatar_id":"","url":"https://api.github.com/users/amcasey","html_url":"https://github.com/amcasey","followers_url":"https://api.github.com/users/amcasey/followers","following_url":"https://api.github.com/users/amcasey/following{/other_user}","gists_url":"https://api.github.com/users/amcasey/gists{/gist_id}","starred_url":"https://api.github.com/users/amcasey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amcasey/subscriptions","organizations_url":"https://api.github.com/users/amcasey/orgs","repos_url":"https://api.github.com/users/amcasey/repos","events_url":"https://api.github.com/users/amcasey/events{/privacy}","received_events_url":"https://api.github.com/users/amcasey/received_events","type":"User","site_admin":false},"assignees":[{"login":"amcasey","id":10508071,"avatar_url":"https://avatars2.githubusercontent.com/u/10508071?v=4","gravatar_id":"","url":"https://api.github.com/users/amcasey","html_url":"https://github.com/amcasey","followers_url":"https://api.github.com/users/amcasey/followers","following_url":"https://api.github.com/users/amcasey/following{/other_user}","gists_url":"https://api.github.com/users/amcasey/gists{/gist_id}","starred_url":"https://api.github.com/users/amcasey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amcasey/subscriptions","organizations_url":"https://api.github.com/users/amcasey/orgs","repos_url":"https://api.github.com/users/amcasey/repos","events_url":"https://api.github.com/users/amcasey/events{/privacy}","received_events_url":"https://api.github.com/users/amcasey/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/Microsoft/TypeScript/milestones/70","html_url":"https://github.com/Microsoft/TypeScript/milestone/70","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/milestones/70/labels","id":3302261,"number":70,"title":"TypeScript 3.0","description":"","creator":{"login":"mhegazy","id":8000722,"avatar_url":"https://avatars3.githubusercontent.com/u/8000722?v=4","gravatar_id":"","url":"https://api.github.com/users/mhegazy","html_url":"https://github.com/mhegazy","followers_url":"https://api.github.com/users/mhegazy/followers","following_url":"https://api.github.com/users/mhegazy/following{/other_user}","gists_url":"https://api.github.com/users/mhegazy/gists{/gist_id}","starred_url":"https://api.github.com/users/mhegazy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhegazy/subscriptions","organizations_url":"https://api.github.com/users/mhegazy/orgs","repos_url":"https://api.github.com/users/mhegazy/repos","events_url":"https://api.github.com/users/mhegazy/events{/privacy}","received_events_url":"https://api.github.com/users/mhegazy/received_events","type":"User","site_admin":false},"open_issues":282,"closed_issues":2,"state":"open","created_at":"2018-04-26T17:58:51Z","updated_at":"2018-05-21T23:11:12Z","due_on":null,"closed_at":null},"comments":8,"created_at":"2018-04-09T20:58:43Z","updated_at":"2018-05-22T01:57:52Z","closed_at":null,"author_association":"COLLABORATOR","body":"From https://github.com/Microsoft/vscode/issues/47287\r\n\r\n**TypeScript Version:**  2.9.0-dev.20180409\r\n\r\n<!-- Search terms you tried before logging this (so others can find this issue more easily) -->\r\n**Search Terms:** \r\n- organize imports\r\n- jsx\r\n\r\n**Code**\r\nFor a simple js project that does not configure `\"jsx`:\r\n\r\n`jsconfig.json`:\r\n\r\n```json\r\n{\r\n    \"compilerOptions\": {\r\n        \"module\": \"commonjs\",\r\n        \"target\": \"es2016\",\r\n        \"experimentalDecorators\": true\r\n    },\r\n    \"exclude\": [\r\n        \"node_modules\",\r\n        \"**/node_modules/*\"\r\n    ]\r\n}\r\n```\r\n\r\n`index.js`:\r\n```js\r\nimport * as React from 'react'\r\n\r\nconst Button = () => <button />\r\n```\r\n\r\n2. Run organize imports\r\n\r\n**Problem:**\r\nTypescript (correctly from its perspective) removes the `React` import as `React` is not referenced anywhere. However this is very confusing for users. \r\n\r\n**Proposal:**\r\nSome ideas:\r\n\r\n- Special case `React` imports for files that use jsx even when you don't have `\"jsx\"` configured\r\n\r\n- Default `\"jsx\"` on for jsconfig projects (the jsconfigs that vscode generates for users already do this). Allow the config to turn if off it a user really needs to\r\n\r\n- Show an editor suggestion on jsx in js files that are part of a jsconfig project that does not configure `\"jsx\"` \r\n"},"comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments/390838379","html_url":"https://github.com/Microsoft/TypeScript/issues/23287#issuecomment-390838379","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/23287","id":390838379,"user":{"login":"mhegazy","id":8000722,"avatar_url":"https://avatars3.githubusercontent.com/u/8000722?v=4","gravatar_id":"","url":"https://api.github.com/users/mhegazy","html_url":"https://github.com/mhegazy","followers_url":"https://api.github.com/users/mhegazy/followers","following_url":"https://api.github.com/users/mhegazy/following{/other_user}","gists_url":"https://api.github.com/users/mhegazy/gists{/gist_id}","starred_url":"https://api.github.com/users/mhegazy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhegazy/subscriptions","organizations_url":"https://api.github.com/users/mhegazy/orgs","repos_url":"https://api.github.com/users/mhegazy/repos","events_url":"https://api.github.com/users/mhegazy/events{/privacy}","received_events_url":"https://api.github.com/users/mhegazy/received_events","type":"User","site_admin":false},"created_at":"2018-05-22T01:57:52Z","updated_at":"2018-05-22T01:57:52Z","author_association":"CONTRIBUTOR","body":"Yes please."}}
{"actor":{"display_login":"mhegazy"}}