{"action":"created","issue":{"url":"https://api.github.com/repos/palantir/tslint/issues/893","labels_url":"https://api.github.com/repos/palantir/tslint/issues/893/labels{/name}","comments_url":"https://api.github.com/repos/palantir/tslint/issues/893/comments","events_url":"https://api.github.com/repos/palantir/tslint/issues/893/events","html_url":"https://github.com/palantir/tslint/issues/893","id":123473035,"number":893,"title":"JSX does not mark `React` as used when imported via `import React = require(\"react\");`","user":{"login":"cezary-biernacki","id":1107199,"avatar_url":"https://avatars.githubusercontent.com/u/1107199?v=3","gravatar_id":"","url":"https://api.github.com/users/cezary-biernacki","html_url":"https://github.com/cezary-biernacki","followers_url":"https://api.github.com/users/cezary-biernacki/followers","following_url":"https://api.github.com/users/cezary-biernacki/following{/other_user}","gists_url":"https://api.github.com/users/cezary-biernacki/gists{/gist_id}","starred_url":"https://api.github.com/users/cezary-biernacki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cezary-biernacki/subscriptions","organizations_url":"https://api.github.com/users/cezary-biernacki/orgs","repos_url":"https://api.github.com/users/cezary-biernacki/repos","events_url":"https://api.github.com/users/cezary-biernacki/events{/privacy}","received_events_url":"https://api.github.com/users/cezary-biernacki/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/palantir/tslint/labels/P2","name":"P2","color":"bbbbbb"},{"url":"https://api.github.com/repos/palantir/tslint/labels/Status:%20Accepting%20PRs","name":"Status: Accepting PRs","color":"0052cc"},{"url":"https://api.github.com/repos/palantir/tslint/labels/Type:%20Bug","name":"Type: Bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-12-22T12:24:32Z","updated_at":"2015-12-23T13:38:17Z","closed_at":null,"body":"I have react option enabled for \"no-unused-variable\"\r\n\r\n     \"no-unused-variable\": [true, \"react\"],\r\n\r\nStill React is reported as unused when imported like this:\r\n\r\n     import React = require(\"react);\r\n\r\nbut this import statement works\r\n   \r\n     import * as React from \"react\";    \r\n  \r\n \r\nExample\r\n\r\n    /// <reference path=\"typings.d.ts\" />\r\n    import React = require(\"react\"); // TSLint reports \"unused variable: 'React'\"\r\n    const result: JSX.Element = <div>Test</div>;\r\n    export = result;\r\n\r\n\r\nIt seems that the problem is caused by react-specific import detection code is only in visitNamespaceImport() method (noUnusedVariableRule.ts file), but not in visitImportEqualsDeclaration() method.\r\n"},"comment":{"url":"https://api.github.com/repos/palantir/tslint/issues/comments/166898060","html_url":"https://github.com/palantir/tslint/issues/893#issuecomment-166898060","issue_url":"https://api.github.com/repos/palantir/tslint/issues/893","id":166898060,"user":{"login":"cezary-biernacki","id":1107199,"avatar_url":"https://avatars.githubusercontent.com/u/1107199?v=3","gravatar_id":"","url":"https://api.github.com/users/cezary-biernacki","html_url":"https://github.com/cezary-biernacki","followers_url":"https://api.github.com/users/cezary-biernacki/followers","following_url":"https://api.github.com/users/cezary-biernacki/following{/other_user}","gists_url":"https://api.github.com/users/cezary-biernacki/gists{/gist_id}","starred_url":"https://api.github.com/users/cezary-biernacki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cezary-biernacki/subscriptions","organizations_url":"https://api.github.com/users/cezary-biernacki/orgs","repos_url":"https://api.github.com/users/cezary-biernacki/repos","events_url":"https://api.github.com/users/cezary-biernacki/events{/privacy}","received_events_url":"https://api.github.com/users/cezary-biernacki/received_events","type":"User","site_admin":false},"created_at":"2015-12-23T13:38:17Z","updated_at":"2015-12-23T13:38:17Z","body":"@JKillian: Yes, the workaround is acceptable, just it is confusing. I had to debug TSLint itself to discover what kind of syntax works, as the documentation does not provide necessary details.\r\n"}}