Skip to content

Commit

Permalink
feat(sort-objects): add custom-ignore to enable customizable ignore rule
Browse files Browse the repository at this point in the history
  • Loading branch information
KID-joker authored and azat-io committed Jul 17, 2024
1 parent 0aa7607 commit 444809c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions rules/sort-objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,6 @@ export default createEslintRule<Options, MESSAGE_ID>({
},
type: 'array',
},
'ignore-function': {
type: 'object',
},
groups: {
type: 'array',
},
Expand Down Expand Up @@ -138,6 +135,7 @@ export default createEslintRule<Options, MESSAGE_ID>({
} as const)

let shouldIgnore = false
let ignoreFunctions = Object.values(options.customIgnore)

if (
ignoreFunctions.length &&
Expand Down
4 changes: 2 additions & 2 deletions test/sort-objects.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2880,7 +2880,7 @@ describe(RULE_NAME, () => {
`,
options: [
{
'ignore-function': {
customIgnore: {
ignoreButtonStyles: (node: TSESTree.ObjectExpression) => {
if (
node.parent.type === 'VariableDeclarator' &&
Expand Down Expand Up @@ -2969,7 +2969,7 @@ describe(RULE_NAME, () => {
`,
options: [
{
'ignore-function': {
customIgnore: {
ignoreButtonStyles: () => false,
},
},
Expand Down

0 comments on commit 444809c

Please sign in to comment.