1 | /**
|
2 | * @fileoverview Rule to disallow an empty pattern
|
3 | * @author Alberto Rodríguez
|
4 | * @copyright 2015 Alberto Rodríguez. All rights reserved.
|
5 | * See LICENSE file in root directory for full license.
|
6 | */
|
7 | ;
|
8 |
|
9 | //------------------------------------------------------------------------------
|
10 | // Rule Definition
|
11 | //------------------------------------------------------------------------------
|
12 |
|
13 | module.exports = function(context) {
|
14 | return {
|
15 | "ObjectPattern": function(node) {
|
16 | if (node.properties.length === 0) {
|
17 | context.report(node, "Unexpected empty object pattern.");
|
18 | }
|
19 | },
|
20 | "ArrayPattern": function(node) {
|
21 | if (node.elements.length === 0) {
|
22 | context.report(node, "Unexpected empty array pattern.");
|
23 | }
|
24 | }
|
25 | };
|
26 | };
|
27 |
|
28 | module.exports.schema = [];
|