Skip to content

Commit 0882a8e

Browse files
authored
✨ Update import order during commit (#269)
* ✨ Feat: Add Prettier plugin for import organization * 🔧 Chore: Replace Prettier import organization plugin * 🔧 Chore: Define import order in prettier config
1 parent 1a7781a commit 0882a8e

File tree

4 files changed

+116
-12
lines changed

4 files changed

+116
-12
lines changed

.prettierrc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"plugins": ["@trivago/prettier-plugin-sort-imports"],
3+
"importOrder": [
4+
"<THIRD_PARTY_MODULES>",
5+
"^@(?!core|web|backend).*$",
6+
"^@core/(.*)$",
7+
"^@web/(.*)$",
8+
"^@backend/(.*)$",
9+
"^[./]"
10+
],
11+
"importOrderSeparation": false,
12+
"importOrderSortSpecifiers": true
13+
}

eslint.config.mjs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
import path from "path";
2-
import { fileURLToPath } from "url";
3-
import globals from "globals";
4-
import pluginJs from "@eslint/js";
5-
import tseslint from "typescript-eslint";
6-
import pluginReact from "eslint-plugin-react";
7-
import reactHooks from "eslint-plugin-react-hooks";
81
import pluginJest from "eslint-plugin-jest";
92
import jestDom from "eslint-plugin-jest-dom";
10-
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
3+
import prettierEslint from "eslint-plugin-prettier";
4+
import pluginReact from "eslint-plugin-react";
5+
import reactHooks from "eslint-plugin-react-hooks";
116
import testingLibrary from "eslint-plugin-testing-library";
7+
import globals from "globals";
8+
import path from "path";
9+
import tseslint from "typescript-eslint";
10+
import { fileURLToPath } from "url";
11+
import pluginJs from "@eslint/js";
12+
import sortImports from "@trivago/prettier-plugin-sort-imports";
1213

1314
const __dirname = path.dirname(fileURLToPath(import.meta.url));
1415

@@ -68,7 +69,8 @@ export default [
6869
"jest/valid-expect": "error",
6970
},
7071
},
71-
// this prettier plugin adjusts other parts of this config,
72-
// so keep it as the last item
73-
eslintPluginPrettierRecommended,
72+
// these plugins adjust other parts of this config,
73+
// so keep them down here
74+
prettierEslint,
75+
sortImports,
7476
];

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"@eslint/compat": "^1.2.6",
4949
"@eslint/eslintrc": "^3.2.0",
5050
"@eslint/js": "^9.20.0",
51+
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
5152
"@types/uuid": "^9.0.0",
5253
"@typescript-eslint/eslint-plugin": "^8.0.0",
5354
"@typescript-eslint/parser": "^8.0.0",
@@ -59,7 +60,6 @@
5960
"eslint": "^9.20.1",
6061
"eslint-config-prettier": "^8.3.0",
6162
"eslint-import-resolver-lerna": "^2.0.0",
62-
"eslint-plugin-import": "^2.3.1",
6363
"eslint-plugin-jest": "^28.11.0",
6464
"eslint-plugin-prettier": "^5.2.3",
6565
"eslint-plugin-react": "^7.37.4",

yarn.lock

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,15 @@
8383
"@babel/highlight" "^7.24.7"
8484
picocolors "^1.0.0"
8585

86+
"@babel/code-frame@^7.26.2":
87+
version "7.26.2"
88+
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.26.2.tgz#4b5fab97d33338eff916235055f0ebc21e573a85"
89+
integrity sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==
90+
dependencies:
91+
"@babel/helper-validator-identifier" "^7.25.9"
92+
js-tokens "^4.0.0"
93+
picocolors "^1.0.0"
94+
8695
"@babel/compat-data@^7.22.6", "@babel/compat-data@^7.25.2", "@babel/compat-data@^7.25.4":
8796
version "7.25.4"
8897
resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.25.4.tgz#7d2a80ce229890edcf4cc259d4d696cb4dae2fcb"
@@ -119,6 +128,17 @@
119128
"@jridgewell/trace-mapping" "^0.3.25"
120129
jsesc "^2.5.1"
121130

131+
"@babel/generator@^7.26.5", "@babel/generator@^7.26.9":
132+
version "7.26.9"
133+
resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.26.9.tgz#75a9482ad3d0cc7188a537aa4910bc59db67cbca"
134+
integrity sha512-kEWdzjOAUMW4hAyrzJ0ZaTOu9OmpyDIQicIh0zg0EEcEkYXZb2TjtBhnHi2ViX7PKwZqF4xwqfAm299/QMP3lg==
135+
dependencies:
136+
"@babel/parser" "^7.26.9"
137+
"@babel/types" "^7.26.9"
138+
"@jridgewell/gen-mapping" "^0.3.5"
139+
"@jridgewell/trace-mapping" "^0.3.25"
140+
jsesc "^3.0.2"
141+
122142
"@babel/helper-annotate-as-pure@^7.22.5", "@babel/helper-annotate-as-pure@^7.24.7":
123143
version "7.24.7"
124144
resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.24.7.tgz#5373c7bc8366b12a033b4be1ac13a206c6656aab"
@@ -255,11 +275,21 @@
255275
resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.24.8.tgz#5b3329c9a58803d5df425e5785865881a81ca48d"
256276
integrity sha512-pO9KhhRcuUyGnJWwyEgnRJTSIZHiT+vMD0kPeD+so0l7mxkMT19g3pjY9GTnHySck/hDzq+dtW/4VgnMkippsQ==
257277

278+
"@babel/helper-string-parser@^7.25.9":
279+
version "7.25.9"
280+
resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz#1aabb72ee72ed35789b4bbcad3ca2862ce614e8c"
281+
integrity sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==
282+
258283
"@babel/helper-validator-identifier@^7.24.7":
259284
version "7.24.7"
260285
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz#75b889cfaf9e35c2aaf42cf0d72c8e91719251db"
261286
integrity sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==
262287

288+
"@babel/helper-validator-identifier@^7.25.9":
289+
version "7.25.9"
290+
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz#24b64e2c3ec7cd3b3c547729b8d16871f22cbdc7"
291+
integrity sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==
292+
263293
"@babel/helper-validator-option@^7.24.7", "@babel/helper-validator-option@^7.24.8":
264294
version "7.24.8"
265295
resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.24.8.tgz#3725cdeea8b480e86d34df15304806a06975e33d"
@@ -299,6 +329,13 @@
299329
dependencies:
300330
"@babel/types" "^7.25.6"
301331

332+
"@babel/parser@^7.26.7", "@babel/parser@^7.26.9":
333+
version "7.26.9"
334+
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.26.9.tgz#d9e78bee6dc80f9efd8f2349dcfbbcdace280fd5"
335+
integrity sha512-81NWa1njQblgZbQHxWHpxxCzNsa3ZwvFqpUg7P+NNUU6f3UU2jBEg4OlF/J6rl8+PQGh1q6/zWScd001YwcA5A==
336+
dependencies:
337+
"@babel/types" "^7.26.9"
338+
302339
"@babel/plugin-bugfix-firefox-class-in-computed-class-key@^7.25.3":
303340
version "7.25.3"
304341
resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-firefox-class-in-computed-class-key/-/plugin-bugfix-firefox-class-in-computed-class-key-7.25.3.tgz#dca427b45a6c0f5c095a1c639dfe2476a3daba7f"
@@ -1112,6 +1149,15 @@
11121149
"@babel/parser" "^7.25.0"
11131150
"@babel/types" "^7.25.0"
11141151

1152+
"@babel/template@^7.26.9":
1153+
version "7.26.9"
1154+
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.26.9.tgz#4577ad3ddf43d194528cff4e1fa6b232fa609bb2"
1155+
integrity sha512-qyRplbeIpNZhmzOysF/wFMuP9sctmh2cFzRAZOn1YapxBsE1i9bJIY586R/WBLfLcmcBlM8ROBiQURnnNy+zfA==
1156+
dependencies:
1157+
"@babel/code-frame" "^7.26.2"
1158+
"@babel/parser" "^7.26.9"
1159+
"@babel/types" "^7.26.9"
1160+
11151161
"@babel/traverse@^7.23.2", "@babel/traverse@^7.24.7", "@babel/traverse@^7.24.8", "@babel/traverse@^7.25.0", "@babel/traverse@^7.25.1", "@babel/traverse@^7.25.2", "@babel/traverse@^7.25.3", "@babel/traverse@^7.25.4", "@babel/traverse@^7.4.5":
11161162
version "7.25.6"
11171163
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.25.6.tgz#04fad980e444f182ecf1520504941940a90fea41"
@@ -1125,6 +1171,19 @@
11251171
debug "^4.3.1"
11261172
globals "^11.1.0"
11271173

1174+
"@babel/traverse@^7.26.7":
1175+
version "7.26.9"
1176+
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.26.9.tgz#4398f2394ba66d05d988b2ad13c219a2c857461a"
1177+
integrity sha512-ZYW7L+pL8ahU5fXmNbPF+iZFHCv5scFak7MZ9bwaRPLUhHh7QQEMjZUg0HevihoqCM5iSYHN61EyCoZvqC+bxg==
1178+
dependencies:
1179+
"@babel/code-frame" "^7.26.2"
1180+
"@babel/generator" "^7.26.9"
1181+
"@babel/parser" "^7.26.9"
1182+
"@babel/template" "^7.26.9"
1183+
"@babel/types" "^7.26.9"
1184+
debug "^4.3.1"
1185+
globals "^11.1.0"
1186+
11281187
"@babel/types@^7.0.0", "@babel/types@^7.20.0", "@babel/types@^7.20.7", "@babel/types@^7.24.7", "@babel/types@^7.24.8", "@babel/types@^7.25.0", "@babel/types@^7.25.2", "@babel/types@^7.25.6", "@babel/types@^7.3.3", "@babel/types@^7.4.4":
11291188
version "7.25.6"
11301189
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.25.6.tgz#893942ddb858f32ae7a004ec9d3a76b3463ef8e6"
@@ -1134,6 +1193,14 @@
11341193
"@babel/helper-validator-identifier" "^7.24.7"
11351194
to-fast-properties "^2.0.0"
11361195

1196+
"@babel/types@^7.26.7", "@babel/types@^7.26.9":
1197+
version "7.26.9"
1198+
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.26.9.tgz#08b43dec79ee8e682c2ac631c010bdcac54a21ce"
1199+
integrity sha512-Y3IR1cRnOxOCDvMmNiym7XpXQ93iGDDPHx+Zj+NM+rg0fBaShfQLkg+hKPaZCEvg5N/LeCo4+Rj/i3FuJsIQaw==
1200+
dependencies:
1201+
"@babel/helper-string-parser" "^7.25.9"
1202+
"@babel/helper-validator-identifier" "^7.25.9"
1203+
11371204
"@bcoe/v8-coverage@^0.2.3":
11381205
version "0.2.3"
11391206
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
@@ -2230,6 +2297,18 @@
22302297
resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-2.0.0.tgz#f544a148d3ab35801c1f633a7441fd87c2e484bf"
22312298
integrity sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==
22322299

2300+
"@trivago/prettier-plugin-sort-imports@^5.2.2":
2301+
version "5.2.2"
2302+
resolved "https://registry.yarnpkg.com/@trivago/prettier-plugin-sort-imports/-/prettier-plugin-sort-imports-5.2.2.tgz#38983f0b83490a0a7d974a6f1e409fb4bf678d02"
2303+
integrity sha512-fYDQA9e6yTNmA13TLVSA+WMQRc5Bn/c0EUBditUHNfMMxN7M82c38b1kEggVE3pLpZ0FwkwJkUEKMiOi52JXFA==
2304+
dependencies:
2305+
"@babel/generator" "^7.26.5"
2306+
"@babel/parser" "^7.26.7"
2307+
"@babel/traverse" "^7.26.7"
2308+
"@babel/types" "^7.26.7"
2309+
javascript-natural-sort "^0.7.1"
2310+
lodash "^4.17.21"
2311+
22332312
"@trysound/sax@0.2.0":
22342313
version "0.2.0"
22352314
resolved "https://registry.yarnpkg.com/@trysound/sax/-/sax-0.2.0.tgz#cccaab758af56761eb7bf37af6f03f326dd798ad"
@@ -7377,6 +7456,11 @@ iterator.prototype@^1.1.4:
73777456
has-symbols "^1.1.0"
73787457
set-function-name "^2.0.2"
73797458

7459+
javascript-natural-sort@^0.7.1:
7460+
version "0.7.1"
7461+
resolved "https://registry.yarnpkg.com/javascript-natural-sort/-/javascript-natural-sort-0.7.1.tgz#f9e2303d4507f6d74355a73664d1440fb5a0ef59"
7462+
integrity sha512-nO6jcEfZWQXDhOiBtG2KvKyEptz7RVbpGP4vTD2hLBdmNQSsCiicO2Ioinv6UI4y9ukqnBpy+XZ9H6uLNgJTlw==
7463+
73807464
jest-changed-files@^29.7.0:
73817465
version "29.7.0"
73827466
resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-29.7.0.tgz#1c06d07e77c78e1585d020424dedc10d6e17ac3a"
@@ -7862,6 +7946,11 @@ jsesc@^2.5.1:
78627946
resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4"
78637947
integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==
78647948

7949+
jsesc@^3.0.2:
7950+
version "3.1.0"
7951+
resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-3.1.0.tgz#74d335a234f67ed19907fdadfac7ccf9d409825d"
7952+
integrity sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==
7953+
78657954
jsesc@~0.5.0:
78667955
version "0.5.0"
78677956
resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d"

0 commit comments

Comments
 (0)