mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
864 B
29 lines
864 B
9 years ago
|
/**
|
||
|
* @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 = [];
|