This seems to work but is it the right way to do it?

var escope = 
require("/usr/local/lib/node_modules/eslint/node_modules/escope");

module.exports = function(context) {
    return {
        ExpressionStatement: function(node) {
            var source = context.getSource(node);
            var matches = 
source.match(/^(?:Cu|Components\.utils)\.import\(".*\/(\w+)\.\w+"\);?$/);

            if (matches) {
                var name = matches[1];
                var scope = context.getScope();
                var variables = scope.variables;
                var variable = new escope.Variable(name, scope);

                variable.eslintExplicitGlobal = false;
                variable.writeable = true;

                variables.push(variable);
            }
        }
    };
};

-- 
You received this message because you are subscribed to the Google Groups 
"ESLint" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to