twreporter-react
Version:
React-Redux site for The Reporter Foundation in Taiwan
29 lines (20 loc) • 699 B
JavaScript
/**
* @fileoverview Rule to flag when initializing to undefined
* @author Ilya Volodin
*/
;
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
module.exports = function(context) {
return {
"VariableDeclarator": function(node) {
var name = node.id.name;
var init = node.init && node.init.name;
if (init === "undefined") {
context.report(node, "It's not necessary to initialize '{{name}}' to undefined.", { name: name });
}
}
};
};
module.exports.schema = [];