From aa948795fe6480e5a5d60a519ca07470f3a0f036 Mon Sep 17 00:00:00 2001 From: ohhoney1 <1269075501@qq.com> Date: Thu, 29 Jul 2021 10:40:00 +0800 Subject: [PATCH] [Test]: `destructuring-assignment` add one test --- tests/lib/rules/destructuring-assignment.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/tests/lib/rules/destructuring-assignment.js b/tests/lib/rules/destructuring-assignment.js index bf6eb46fa9..185c788e7c 100644 --- a/tests/lib/rules/destructuring-assignment.js +++ b/tests/lib/rules/destructuring-assignment.js @@ -180,9 +180,9 @@ ruleTester.run('destructuring-assignment', rule, { // https://github.com/yannickcr/eslint-plugin-react/issues/2911 { code: ` - function Foo({context}) { - const d = context.describe() - return
{d}
+ function Foo({ context }) { + const d = context.describe(); + return
{d}
; } `, options: ['always'], @@ -412,5 +412,18 @@ ruleTester.run('destructuring-assignment', rule, { messageId: 'useDestructAssignment', data: {type: 'props'} }] + }, { + code: ` + function Foo(props, context) { + const d = context.describe(); + return
{d}
; + } + `, + options: ['always'], + parser: parsers.BABEL_ESLINT, + errors: [{ + messageId: 'useDestructAssignment', + data: {type: 'context'} + }] }] });