From a1a98464c899b7cb92265291a06e9465e2319324 Mon Sep 17 00:00:00 2001 From: KID-joker Date: Mon, 22 Apr 2024 08:36:47 +0800 Subject: [PATCH] feat(sort-objects): add custom-ignore to enable customizable ignore rule --- rules/sort-objects.ts | 3 ++- test/sort-objects.test.ts | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/rules/sort-objects.ts b/rules/sort-objects.ts index 0bc7c9721..61c70be77 100644 --- a/rules/sort-objects.ts +++ b/rules/sort-objects.ts @@ -96,7 +96,7 @@ export default createEslintRule({ }, type: 'array', }, - 'ignore-function': { + customIgnore: { type: 'object', }, groups: { @@ -137,6 +137,7 @@ export default createEslintRule({ } as const) let shouldIgnore = false + let ignoreFunctions = Object.values(options.customIgnore) if ( ignoreFunctions.length && diff --git a/test/sort-objects.test.ts b/test/sort-objects.test.ts index 26f7a8f9a..62c941ee1 100644 --- a/test/sort-objects.test.ts +++ b/test/sort-objects.test.ts @@ -2880,7 +2880,7 @@ describe(RULE_NAME, () => { `, options: [ { - 'ignore-function': { + customIgnore: { ignoreButtonStyles: (node: TSESTree.ObjectExpression) => { if ( node.parent.type === 'VariableDeclarator' && @@ -2969,7 +2969,7 @@ describe(RULE_NAME, () => { `, options: [ { - 'ignore-function': { + customIgnore: { ignoreButtonStyles: () => false, }, },