Blame view
node_modules/eslint/lib/rules/no-undef-init.js
836 Bytes
c39994410
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
/** * @fileoverview Rule to flag when initializing to undefined * @author Ilya Volodin * @copyright 2013 Ilya Volodin. All rights reserved. * See LICENSE in root directory for full license. */ "use strict"; //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ module.exports = function(context) { return { "VariableDeclarator": function(node) { var name = node.id.name, init = node.init && node.init.name; if (init === "undefined" && node.parent.kind !== "const") { context.report(node, "It's not necessary to initialize '{{name}}' to undefined.", { name: name }); } } }; }; module.exports.schema = []; |