From ce952cd190aa66270895b20c1e7aabddb5590024 Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Tue, 18 Jul 2023 11:58:39 +0200 Subject: [PATCH 1/4] Ignore `SpreadExpression`s in `no-only-tests` --- lib/rules/no-only-tests.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/rules/no-only-tests.js b/lib/rules/no-only-tests.js index 1c89bcac..49206f61 100644 --- a/lib/rules/no-only-tests.js +++ b/lib/rules/no-only-tests.js @@ -36,6 +36,7 @@ module.exports = { const onlyProperty = test.properties.find( (property) => + property.type === 'Property' && property.key.type === 'Identifier' && property.key.name === 'only' && property.value.type === 'Literal' && From 7d3a7d34109c683e6d1c1f9235554034cf108982 Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Tue, 18 Jul 2023 12:00:30 +0200 Subject: [PATCH 2/4] Add test case --- tests/lib/rules/no-only-tests.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/lib/rules/no-only-tests.js b/tests/lib/rules/no-only-tests.js index 24efa23d..ed892aa6 100644 --- a/tests/lib/rules/no-only-tests.js +++ b/tests/lib/rules/no-only-tests.js @@ -23,7 +23,8 @@ ruleTester.run('no-only-tests', rule, { 'foo', { code: 'foo', foo: true }, RuleTester.somethingElse(), - notRuleTester.only() + notRuleTester.only(), + { ...otherOptions }, ], invalid: [ { code: 'bar', foo: true }, From ef3307676bc75feba9e7cacca7ce840022f2c28e Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Tue, 18 Jul 2023 12:23:34 +0200 Subject: [PATCH 3/4] Ignore `SpreadExpression`s in `prefer-output-null` --- lib/rules/prefer-output-null.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/rules/prefer-output-null.js b/lib/rules/prefer-output-null.js index a7abfd12..4403b7e8 100644 --- a/lib/rules/prefer-output-null.js +++ b/lib/rules/prefer-output-null.js @@ -48,7 +48,9 @@ module.exports = { */ function getTestInfo(key) { if (test.type === 'ObjectExpression') { - return test.properties.find((item) => item.key.name === key); + return test.properties.find( + (item) => item.type === 'Property' && item.key.name === key + ); } return null; } From 8f63312dc30566b61ea02206606c0640e1490063 Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Tue, 18 Jul 2023 12:24:13 +0200 Subject: [PATCH 4/4] Add test case --- tests/lib/rules/prefer-output-null.js | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/lib/rules/prefer-output-null.js b/tests/lib/rules/prefer-output-null.js index 4fd5014d..910a8093 100644 --- a/tests/lib/rules/prefer-output-null.js +++ b/tests/lib/rules/prefer-output-null.js @@ -25,6 +25,7 @@ ruleTester.run('prefer-output-null', rule, { new RuleTester().run('foo', bar, { valid: [], invalid: [ + { ...otherOptions }, {code: 'foo', output: 'bar', errors: ['bar']}, ] });