Repository: eslint/eslint
File: lib/rules/no-empty-pattern.js (JavaScript)

Code before:
                        default: false
                    }
                },
                additionalProperties: false
            }
        ],

        messages: {
            unexpected: "Unexpected empty {{type}} pattern."
        }
    },

    create(context) {
        const options = context.options[0] || {},
            allowObjectPatternsAsParameters = options.allowObjectPatternsAsParameters || false;

        return {
            ObjectPattern(node) {

                if (node.properties.length > 0) {
                    return;
                }

                // Allow {} and {} = {} empty object patterns in Arrow functions as parameters when allowObjectPatternsAsParameters is true
                if (
                    allowObjectPatternsAsParameters === true &&
                    (
                        astUtils.isFunction(node.parent) ||
                        (
                            node.parent.type === "AssignmentPattern" &&
                            astUtils.isFunction(node.parent.parent) &&
                            node.parent.right.type === "ObjectExpression" &&
                            node.parent.right.properties.length === 0
                        )
                    )
                ) {
                    return;
                }

                context.report({ node, messageId: "unexpected", data: { type: "object" } });
            },
            ArrayPattern(node) {
                if (node.elements.length === 0) {
                    context.report({ node, messageId: "unexpected", data: { type: "array" } });
                }
            }
        };
    }
};


Review comment (suggestion):
```suggestion
                    allowObjectPatternsAsParameters &&
```

No need for `=== true`.

Code after:
                        default: false
                    }
                },
                additionalProperties: false
            }
        ],

        messages: {
            unexpected: "Unexpected empty {{type}} pattern."
        }
    },

    create(context) {
        const options = context.options[0] || {},
            allowObjectPatternsAsParameters = options.allowObjectPatternsAsParameters || false;

        return {
            ObjectPattern(node) {

                if (node.properties.length > 0) {
                    return;
                }

                // Allow {} and {} = {} empty object patterns as parameters when allowObjectPatternsAsParameters is true
                if (
                    allowObjectPatternsAsParameters &&
                    (
                        astUtils.isFunction(node.parent) ||
                        (
                            node.parent.type === "AssignmentPattern" &&
                            astUtils.isFunction(node.parent.parent) &&
                            node.parent.right.type === "ObjectExpression" &&
                            node.parent.right.properties.length === 0
                        )
                    )
                ) {
                    return;
                }

                context.report({ node, messageId: "unexpected", data: { type: "object" } });
            },
            ArrayPattern(node) {
                if (node.elements.length === 0) {
                    context.report({ node, messageId: "unexpected", data: { type: "array" } });
                }
            }
        };
    }
};