{"action":"created","issue":{"url":"https://api.github.com/repos/eslint/eslint/issues/1905","labels_url":"https://api.github.com/repos/eslint/eslint/issues/1905/labels{/name}","comments_url":"https://api.github.com/repos/eslint/eslint/issues/1905/comments","events_url":"https://api.github.com/repos/eslint/eslint/issues/1905/events","html_url":"https://github.com/eslint/eslint/issues/1905","id":59356044,"number":1905,"title":"Allow to configure implicitly required variables for JSX identifiers via pluggable API","user":{"login":"gaearon","id":810438,"avatar_url":"https://avatars.githubusercontent.com/u/810438?v=3","gravatar_id":"","url":"https://api.github.com/users/gaearon","html_url":"https://github.com/gaearon","followers_url":"https://api.github.com/users/gaearon/followers","following_url":"https://api.github.com/users/gaearon/following{/other_user}","gists_url":"https://api.github.com/users/gaearon/gists{/gist_id}","starred_url":"https://api.github.com/users/gaearon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gaearon/subscriptions","organizations_url":"https://api.github.com/users/gaearon/orgs","repos_url":"https://api.github.com/users/gaearon/repos","events_url":"https://api.github.com/users/gaearon/events{/privacy}","received_events_url":"https://api.github.com/users/gaearon/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/eslint/eslint/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-02-28T20:09:15Z","updated_at":"2015-03-01T00:17:45Z","closed_at":null,"body":"I'm not a parser person so forgive if my terminology is off.\r\n\r\nI propose #1867 not be ignored, but solved in a way that is not specific for React. To remind you, the original issue is React's JSX requiring `React` to be in scope:\r\n\r\n```js\r\nvar React = require('react'); // ESLint thinks it's unused, but in in fact *is* used (and needed!)\r\nvar Table = require('Table.jsx');\r\n\r\nmodule.exports = (\r\n  <Table />\r\n);\r\n```\r\n\r\nactually compiles to\r\n\r\n```js\r\nvar React = require('react');\r\nvar Table = require('Table.jsx');\r\n\r\nmodule.exports = (\r\n  React.createElement(Table, null) // Because this will actually will use React\r\n);\r\n```\r\n\r\nI understand maintainers not wanting to special-case React in any way and I agree it's sensible. (Other libs may want to adopt JSX for their purposes.)\r\n\r\nWhat I propose is making it possible (via custom parser like babel-eslint, or via some other extension point provided by ESLint) for consumer **to specify which variables are implicitly required by JSX identifiers.**\r\n\r\nFor example, I might have config like\r\n\r\n```js\r\n{\r\n  \"parser\": \"babel-eslint\",\r\n  \"jsx-target\": \"react-eslint\" // I'm bad at naming things lol\r\n}\r\n```\r\n\r\nWhere `react-eslint` would be a package that, if specified, tells ESLint that any use of JSX identifier is equivalent to using `React` in that scope.\r\n\r\n<bountysource-plugin>\r\n---\r\nWant to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/9054385-allow-to-configure-implicitly-required-variables-for-jsx-identifiers-via-pluggable-api?utm_campaign=plugin&utm_content=tracker%2F282608&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F282608&utm_medium=issues&utm_source=github).\r\n</bountysource-plugin>"},"comment":{"url":"https://api.github.com/repos/eslint/eslint/issues/comments/76560600","html_url":"https://github.com/eslint/eslint/issues/1905#issuecomment-76560600","issue_url":"https://api.github.com/repos/eslint/eslint/issues/1905","id":76560600,"user":{"login":"gaearon","id":810438,"avatar_url":"https://avatars.githubusercontent.com/u/810438?v=3","gravatar_id":"","url":"https://api.github.com/users/gaearon","html_url":"https://github.com/gaearon","followers_url":"https://api.github.com/users/gaearon/followers","following_url":"https://api.github.com/users/gaearon/following{/other_user}","gists_url":"https://api.github.com/users/gaearon/gists{/gist_id}","starred_url":"https://api.github.com/users/gaearon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gaearon/subscriptions","organizations_url":"https://api.github.com/users/gaearon/orgs","repos_url":"https://api.github.com/users/gaearon/repos","events_url":"https://api.github.com/users/gaearon/events{/privacy}","received_events_url":"https://api.github.com/users/gaearon/received_events","type":"User","site_admin":false},"created_at":"2015-03-01T00:17:45Z","updated_at":"2015-03-01T00:17:45Z","body":">Interesting, your response actually makes me think that using a comment to opt out is the best way forward.\r\n\r\nIt seems so! One minor thing I don't like about it is linter won't warn me if I'm using JSX and *not* importing React—JSXHint did that for me. Still, I can live with that :-)\r\n\r\nThank you for the discussion. Hopefully React team will solve this in the future."}}