From 9691739cc0a4d2ba5d042f3ef3bd43d7926f89c1 Mon Sep 17 00:00:00 2001 From: Julian <66846059+Julian702@users.noreply.github.com> Date: Fri, 22 Sep 2023 19:01:30 +0200 Subject: [PATCH] Configure formatter to sort imports --- .gitignore | 1 - frontend/.prettierrc | 6 ++- frontend/.vscode/settings.json | 3 ++ frontend/package-lock.json | 87 ++++++++++++++++++++++++++++++++++ frontend/package.json | 1 + frontend/tsconfig.json | 5 +- 6 files changed, 100 insertions(+), 3 deletions(-) create mode 100644 frontend/.vscode/settings.json diff --git a/.gitignore b/.gitignore index 421bfecc..c39c5e52 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ .idea -.vscode *secret.yaml private_key.yaml .DS_STORE diff --git a/frontend/.prettierrc b/frontend/.prettierrc index dfcc0e9d..f153bbcc 100644 --- a/frontend/.prettierrc +++ b/frontend/.prettierrc @@ -1,4 +1,8 @@ { "tabWidth": 4, - "useTabs": true + "useTabs": true, + "plugins": ["@trivago/prettier-plugin-sort-imports"], + "importOrder": ["^@core/(.*)$", "^@server/(.*)$", "^@ui/(.*)$", "^@/(.*)$", "^[./]"], + "importOrderSeparation": true, + "importOrderSortSpecifiers": true } diff --git a/frontend/.vscode/settings.json b/frontend/.vscode/settings.json new file mode 100644 index 00000000..0734b97e --- /dev/null +++ b/frontend/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "typescript.preferences.importModuleSpecifier": "non-relative" +} \ No newline at end of file diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 815b9fb0..4c5e789b 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -36,6 +36,7 @@ "@storybook/react": "^7.3.1", "@storybook/testing-library": "^0.2.0", "@storybook/theming": "^7.3.1", + "@trivago/prettier-plugin-sort-imports": "^4.2.0", "@types/jwt-decode": "^3.1.0", "@types/react-calendar-heatmap": "^1.6.3", "autoprefixer": "^10.4.14", @@ -5711,6 +5712,86 @@ "@testing-library/dom": ">=7.21.4" } }, + "node_modules/@trivago/prettier-plugin-sort-imports": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@trivago/prettier-plugin-sort-imports/-/prettier-plugin-sort-imports-4.2.0.tgz", + "integrity": "sha512-YBepjbt+ZNBVmN3ev1amQH3lWCmHyt5qTbLCp/syXJRu/Kw2koXh44qayB1gMRxcL/gV8egmjN5xWSrYyfUtyw==", + "dev": true, + "dependencies": { + "@babel/generator": "7.17.7", + "@babel/parser": "^7.20.5", + "@babel/traverse": "7.17.3", + "@babel/types": "7.17.0", + "javascript-natural-sort": "0.7.1", + "lodash": "^4.17.21" + }, + "peerDependencies": { + "@vue/compiler-sfc": "3.x", + "prettier": "2.x - 3.x" + }, + "peerDependenciesMeta": { + "@vue/compiler-sfc": { + "optional": true + } + } + }, + "node_modules/@trivago/prettier-plugin-sort-imports/node_modules/@babel/generator": { + "version": "7.17.7", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.17.7.tgz", + "integrity": "sha512-oLcVCTeIFadUoArDTwpluncplrYBmTCCZZgXCbgNGvOBBiSDDK3eWO4b/+eOTli5tKv1lg+a5/NAXg+nTcei1w==", + "dev": true, + "dependencies": { + "@babel/types": "^7.17.0", + "jsesc": "^2.5.1", + "source-map": "^0.5.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@trivago/prettier-plugin-sort-imports/node_modules/@babel/traverse": { + "version": "7.17.3", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.17.3.tgz", + "integrity": "sha512-5irClVky7TxRWIRtxlh2WPUUOLhcPN06AGgaQSB8AEwuyEBgJVuJ5imdHm5zxk8w0QS5T+tDfnDxAlhWjpb7cw==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.16.7", + "@babel/generator": "^7.17.3", + "@babel/helper-environment-visitor": "^7.16.7", + "@babel/helper-function-name": "^7.16.7", + "@babel/helper-hoist-variables": "^7.16.7", + "@babel/helper-split-export-declaration": "^7.16.7", + "@babel/parser": "^7.17.3", + "@babel/types": "^7.17.0", + "debug": "^4.1.0", + "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@trivago/prettier-plugin-sort-imports/node_modules/@babel/types": { + "version": "7.17.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.17.0.tgz", + "integrity": "sha512-TmKSNO4D5rzhL5bjWFcVHHLETzfQ/AmbKpKPOSjlP0WoHZ6L911fgoOKY4Alp/emzG4cHJdyN49zpgkbXFEHHw==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.16.7", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@trivago/prettier-plugin-sort-imports/node_modules/source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/@types/aria-query": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.1.tgz", @@ -12076,6 +12157,12 @@ "node": ">=10" } }, + "node_modules/javascript-natural-sort": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/javascript-natural-sort/-/javascript-natural-sort-0.7.1.tgz", + "integrity": "sha512-nO6jcEfZWQXDhOiBtG2KvKyEptz7RVbpGP4vTD2hLBdmNQSsCiicO2Ioinv6UI4y9ukqnBpy+XZ9H6uLNgJTlw==", + "dev": true + }, "node_modules/jest-haste-map": { "version": "29.6.2", "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.6.2.tgz", diff --git a/frontend/package.json b/frontend/package.json index d25b5090..a07d8cb1 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -40,6 +40,7 @@ "@storybook/react": "^7.3.1", "@storybook/testing-library": "^0.2.0", "@storybook/theming": "^7.3.1", + "@trivago/prettier-plugin-sort-imports": "^4.2.0", "@types/jwt-decode": "^3.1.0", "@types/react-calendar-heatmap": "^1.6.3", "autoprefixer": "^10.4.14", diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json index 99710e85..d5dec42c 100644 --- a/frontend/tsconfig.json +++ b/frontend/tsconfig.json @@ -13,7 +13,10 @@ "resolveJsonModule": true, "isolatedModules": true, "jsx": "preserve", - "incremental": true + "incremental": true, + "paths": { + "@/*": ["./*"] + }, }, "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], "exclude": ["node_modules"]