Current Dev State

This commit is contained in:
Tim Lorsbach
2025-06-23 20:13:54 +02:00
parent b4f9bb277d
commit ded50edaa2
22617 changed files with 4345095 additions and 174 deletions

View File

@ -0,0 +1,36 @@
/**
* @fileoverview Rule to disallow an empty pattern
* @author Alberto Rodríguez
*/
"use strict";
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
module.exports = {
meta: {
docs: {
description: "disallow empty destructuring patterns",
category: "Best Practices",
recommended: true
},
schema: []
},
create(context) {
return {
ObjectPattern(node) {
if (node.properties.length === 0) {
context.report({ node, message: "Unexpected empty object pattern." });
}
},
ArrayPattern(node) {
if (node.elements.length === 0) {
context.report({ node, message: "Unexpected empty array pattern." });
}
}
};
}
};