Blame view
node_modules/eslint/lib/rules/no-empty-pattern.js
864 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 |
/** * @fileoverview Rule to disallow an empty pattern * @author Alberto RodrÃguez * @copyright 2015 Alberto RodrÃguez. All rights reserved. * See LICENSE file in root directory for full license. */ "use strict"; //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ module.exports = function(context) { return { "ObjectPattern": function(node) { if (node.properties.length === 0) { context.report(node, "Unexpected empty object pattern."); } }, "ArrayPattern": function(node) { if (node.elements.length === 0) { context.report(node, "Unexpected empty array pattern."); } } }; }; module.exports.schema = []; |