174f64ccb1444516b9ac00d6e78de97bb112bf31
[platform/framework/web/crosswalk-tizen.git] /
1 /**
2  * @fileoverview Prevent variables used in JSX to be marked as unused
3  * @author Yannick Croissant
4  */
5 'use strict';
6
7 var variableUtil = require('../util/variable');
8
9 // ------------------------------------------------------------------------------
10 // Rule Definition
11 // ------------------------------------------------------------------------------
12
13 module.exports = function(context) {
14
15   return {
16     JSXExpressionContainer: function(node) {
17       if (node.expression.type !== 'Identifier') {
18         return;
19       }
20       variableUtil.markVariableAsUsed(context, node.expression.name);
21     },
22
23     JSXIdentifier: function(node) {
24       variableUtil.markVariableAsUsed(context, node.name);
25     }
26
27   };
28
29 };