2 * @fileoverview Prevent missing React when using JSX
7 var variableUtil = require('../util/variable');
9 // -----------------------------------------------------------------------------
11 // -----------------------------------------------------------------------------
13 var JSX_ANNOTATION_REGEX = /^\*\s*@jsx\s+([^\s]+)/;
15 module.exports = function(context) {
18 var NOT_DEFINED_MESSAGE = '\'{{name}}\' must be in scope when using JSX';
22 JSXOpeningElement: function(node) {
23 var variables = variableUtil.variablesInScope(context);
24 if (variableUtil.findVariable(variables, id)) {
27 context.report(node, NOT_DEFINED_MESSAGE, {
32 BlockComment: function(node) {
33 var matches = JSX_ANNOTATION_REGEX.exec(node.value);
37 id = matches[1].split('.')[0];