mirror of
https://github.com/nodejs/node.git
synced 2025-05-18 17:26:24 +00:00

PR-URL: https://github.com/nodejs/io.js/pull/2286 Reviewed-By: Roman Reiss <me@silverwind.io>
29 lines
864 B
JavaScript
29 lines
864 B
JavaScript
/**
|
|
* @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 = [];
|