From 276092bcab9ef64602073ab752c48eaed683b3aa Mon Sep 17 00:00:00 2001 From: Patrick Taylor Date: Tue, 16 Jul 2024 13:00:33 +0100 Subject: [PATCH] =?UTF-8?q?Configured=20`eslint-plugin-sort-exports`=20?= =?UTF-8?q?=E2=9B=B4=EF=B8=8F=20(#8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .depcheckrc | 1 + config/eslint/build-config.ts | 11 +++++++---- config/eslint/rules/sort-exports.ts | 8 ++++++++ package.json | 2 ++ yarn.lock | 14 ++++++++++++++ 5 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 config/eslint/rules/sort-exports.ts diff --git a/.depcheckrc b/.depcheckrc index c7c35ef..723f9d3 100644 --- a/.depcheckrc +++ b/.depcheckrc @@ -1,6 +1,7 @@ ignores: [ "eslint-plugin-inclusive-language", "eslint-plugin-sort-destructure-keys", + "eslint-plugin-sort-exports", "rimraf", "@types/jest" ] diff --git a/config/eslint/build-config.ts b/config/eslint/build-config.ts index df0c9ec..5c89c71 100644 --- a/config/eslint/build-config.ts +++ b/config/eslint/build-config.ts @@ -1,14 +1,17 @@ -import InclusiveLanguageRules from './rules/inclusive-language' -import SortDestructureKeysRules from './rules/sort-destructure-keys' +import InclusiveLanguage from './rules/inclusive-language' +import SortDestructureKeys from './rules/sort-destructure-keys' +import SortExports from './rules/sort-exports' const buildConfig = () => ({ plugins: [ 'inclusive-language', 'sort-destructure-keys', + 'sort-exports', ], rules: { - ...InclusiveLanguageRules, - ...SortDestructureKeysRules, + ...InclusiveLanguage, + ...SortDestructureKeys, + ...SortExports, }, }) diff --git a/config/eslint/rules/sort-exports.ts b/config/eslint/rules/sort-exports.ts new file mode 100644 index 0000000..b93361c --- /dev/null +++ b/config/eslint/rules/sort-exports.ts @@ -0,0 +1,8 @@ +// https://github.com/jrdrg/eslint-plugin-sort-exports + +export default { + 'sort-exports/sort-exports': [2, { + sortDir: 'asc', + sortExportKindFirst: 'type', + }], +} diff --git a/package.json b/package.json index 9edb4b5..045d198 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "eslint": "9.4.0", "eslint-plugin-inclusive-language": "2.2.1", "eslint-plugin-sort-destructure-keys": "2.0.0", + "eslint-plugin-sort-exports": "0.9.1", "glob": "10.4.1", "markdownlint": "0.34.0", "node-notifier": "10.0.1", @@ -57,6 +58,7 @@ "eslint", "eslint-plugin-inclusive-language", "eslint-plugin-sort-destructure-keys", + "eslint-plugin-sort-exports", "lint", "markdownlint", "stylelint" diff --git a/yarn.lock b/yarn.lock index 966abf5..b7d3fd9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2408,6 +2408,13 @@ eslint-plugin-sort-destructure-keys@2.0.0: dependencies: natural-compare-lite "^1.4.0" +eslint-plugin-sort-exports@0.9.1: + version "0.9.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-sort-exports/-/eslint-plugin-sort-exports-0.9.1.tgz#f9641d80d8237e0994bfd9aad38fa8e6d07dfa91" + integrity sha512-2w6jHusdF2K60bcGKpa9HEinETwNzVrvplZipVculCfu3ZDd5IW3xL54XVEnVkGIPJnp/LitFCg7owL4DOtuHg== + dependencies: + minimatch "^9.0.3" + eslint-scope@^8.0.1: version "8.0.1" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-8.0.1.tgz#a9601e4b81a0b9171657c343fb13111688963cfc" @@ -3625,6 +3632,13 @@ minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: dependencies: brace-expansion "^1.1.7" +minimatch@^9.0.3: + version "9.0.5" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.5.tgz#d74f9dd6b57d83d8e98cfb82133b03978bc929e5" + integrity sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow== + dependencies: + brace-expansion "^2.0.1" + minimatch@^9.0.4: version "9.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.4.tgz#8e49c731d1749cbec05050ee5145147b32496a51"