From f406d4bdc25d8ac40856de47cb71d4d4fb35ab94 Mon Sep 17 00:00:00 2001 From: Alireza Safaierad Date: Sun, 20 Oct 2024 00:02:31 +0200 Subject: [PATCH] feat: improve sort intersections --- src/modules/perfectionist.mjs | 52 +++++++++++++++++++++++++++++++---- src/modules/react.mjs | 2 +- src/modules/typescript.mjs | 1 + 3 files changed, 49 insertions(+), 6 deletions(-) diff --git a/src/modules/perfectionist.mjs b/src/modules/perfectionist.mjs index 4449a8a..73d571f 100644 --- a/src/modules/perfectionist.mjs +++ b/src/modules/perfectionist.mjs @@ -14,17 +14,59 @@ function perfectionist() { 'perfectionist/sort-exports': 'warn', 'perfectionist/sort-imports': ['warn', {}], 'perfectionist/sort-interfaces': 'off', - 'perfectionist/sort-intersection-types': 'warn', - 'perfectionist/sort-jsx-props': 'warn', - 'perfectionist/sort-maps': 'warn', + 'perfectionist/sort-intersection-types': [ + 'warn', + { + groups: [ + 'conditional', + 'function', + 'import', + 'intersection', + 'keyword', + 'literal', + 'named', + 'object', + 'operator', + 'tuple', + 'union', + 'nullish', + ], + }, + ], + 'perfectionist/sort-jsx-props': [ + 'warn', + { + groups: ['shorthand', 'unknown', 'callback', 'multiline'], + customGroups: { callback: 'on*' }, + }, + ], + 'perfectionist/sort-maps': 'off', 'perfectionist/sort-named-exports': 'warn', 'perfectionist/sort-named-imports': 'warn', 'perfectionist/sort-object-types': 'off', 'perfectionist/sort-objects': 'off', 'perfectionist/sort-sets': 'warn', 'perfectionist/sort-svelte-attributes': 'warn', - 'perfectionist/sort-switch-case': 'warn', - 'perfectionist/sort-union-types': 'warn', + 'perfectionist/sort-switch-case': 'off', + 'perfectionist/sort-union-types': [ + 'warn', + { + groups: [ + 'conditional', + 'function', + 'import', + 'intersection', + 'keyword', + 'literal', + 'named', + 'object', + 'operator', + 'tuple', + 'union', + 'nullish', + ], + }, + ], 'perfectionist/sort-variable-declarations': 'warn', 'perfectionist/sort-vue-attributes': 'warn', }, diff --git a/src/modules/react.mjs b/src/modules/react.mjs index 85b52dd..73ceb17 100644 --- a/src/modules/react.mjs +++ b/src/modules/react.mjs @@ -18,7 +18,7 @@ function react() { }, rules: { '@eslint-react/dom/no-children-in-void-dom-elements': 'warn', - '@eslint-react/dom/no-dangerously-set-innerhtml': 'warn', + '@eslint-react/dom/no-dangerously-set-innerhtml': 'off', '@eslint-react/dom/no-dangerously-set-innerhtml-with-children': 'error', '@eslint-react/dom/no-find-dom-node': 'error', '@eslint-react/dom/no-missing-button-type': 'warn', diff --git a/src/modules/typescript.mjs b/src/modules/typescript.mjs index cfffac1..0f9b1ce 100644 --- a/src/modules/typescript.mjs +++ b/src/modules/typescript.mjs @@ -214,6 +214,7 @@ function typescript(options = {}) { 'react/jsx-no-useless-fragment': 'off', // Need useless-fragment for JSX return type // Conflicts with @typescript-eslint + 'default-case': 'off', 'import/named': 'off', 'import/namespace': 'off', 'import/default': 'off',