mirror of
https://github.com/nodejs/node.git
synced 2025-05-19 07:50:07 +00:00

PR-URL: https://github.com/nodejs/io.js/pull/2072 Reviewed-By: Yosuke Furukawa <yosuke.furukawa@gmail.com> Reviewed-by: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Alex Kocharin <alex@kocharin.ru>
29 lines
699 B
JavaScript
29 lines
699 B
JavaScript
/**
|
|
* @fileoverview Rule to flag when initializing to undefined
|
|
* @author Ilya Volodin
|
|
*/
|
|
|
|
"use strict";
|
|
|
|
//------------------------------------------------------------------------------
|
|
// 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 = [];
|