From 13aabf402244e972412e0467cbc168cbda00a8ae Mon Sep 17 00:00:00 2001 From: Jon Koops Date: Fri, 12 Apr 2024 10:34:18 +0200 Subject: [PATCH] Move ESLint configuration to project root (#28639) Signed-off-by: Jon Koops --- .vscode/settings.json | 3 --- js/eslint.config.js => eslint.config.js | 5 ----- js/.husky/pre-commit | 2 +- js/.prettierrc.json | 3 --- js/apps/account-ui/tsconfig.json | 7 ++----- js/apps/admin-ui/cypress/support/util/AdminClient.ts | 2 +- js/apps/admin-ui/tsconfig.json | 7 ++----- js/libs/keycloak-admin-client/tsconfig.json | 4 ++-- js/libs/keycloak-masthead/tsconfig.json | 9 +++------ js/libs/ui-shared/tsconfig.json | 9 +++------ js/lint-staged.config.js | 8 -------- package.json | 5 ++++- js/tsconfig.eslint.json => tsconfig.eslint.json | 0 js/tsconfig.json => tsconfig.json | 2 +- 14 files changed, 19 insertions(+), 47 deletions(-) delete mode 100644 .vscode/settings.json rename js/eslint.config.js => eslint.config.js (98%) delete mode 100644 js/.prettierrc.json delete mode 100644 js/lint-staged.config.js rename js/tsconfig.eslint.json => tsconfig.eslint.json (100%) rename js/tsconfig.json => tsconfig.json (95%) diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 8e7ff89af7c..00000000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "eslint.workingDirectories": ["js"] -} diff --git a/js/eslint.config.js b/eslint.config.js similarity index 98% rename from js/eslint.config.js rename to eslint.config.js index f1e023c9d3e..b2897359fa3 100644 --- a/js/eslint.config.js +++ b/eslint.config.js @@ -37,11 +37,6 @@ export default tseslint.config( tsconfigRootDir: import.meta.dirname, }, }, - settings: { - react: { - version: "detect", - }, - }, rules: { // ## Rules overwriting config, disabled for now, but will have to be evaluated. ## "no-undef": "off", diff --git a/js/.husky/pre-commit b/js/.husky/pre-commit index f96aca84fdb..24f1b40ca62 100755 --- a/js/.husky/pre-commit +++ b/js/.husky/pre-commit @@ -7,4 +7,4 @@ if [ ! -f "$FILE" ]; then exit 0; fi -ESLINT_USE_FLAT_CONFIG=true pnpm exec lint-staged +pnpm exec lint-staged diff --git a/js/.prettierrc.json b/js/.prettierrc.json deleted file mode 100644 index f432d389e3a..00000000000 --- a/js/.prettierrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "singleQuote": false -} \ No newline at end of file diff --git a/js/apps/account-ui/tsconfig.json b/js/apps/account-ui/tsconfig.json index 760d145dde8..eeda960f6e2 100644 --- a/js/apps/account-ui/tsconfig.json +++ b/js/apps/account-ui/tsconfig.json @@ -1,8 +1,5 @@ { - "extends": "../../tsconfig.json", + "extends": "../../../tsconfig.json", "include": ["src"], - "exclude": [ - "**/*.test.ts", - "**/*.test.tsx" - ] + "exclude": ["**/*.test.ts", "**/*.test.tsx"] } diff --git a/js/apps/admin-ui/cypress/support/util/AdminClient.ts b/js/apps/admin-ui/cypress/support/util/AdminClient.ts index 1a1d67925c5..4c03e632394 100644 --- a/js/apps/admin-ui/cypress/support/util/AdminClient.ts +++ b/js/apps/admin-ui/cypress/support/util/AdminClient.ts @@ -6,7 +6,7 @@ import type RoleRepresentation from "@keycloak/keycloak-admin-client/lib/defs/ro import type { RoleMappingPayload } from "@keycloak/keycloak-admin-client/lib/defs/roleRepresentation"; import type { UserProfileConfig } from "@keycloak/keycloak-admin-client/lib/defs/userProfileMetadata"; import type UserRepresentation from "@keycloak/keycloak-admin-client/lib/defs/userRepresentation"; -import { Credentials } from "libs/keycloak-admin-client/lib/utils/auth"; +import { Credentials } from "@keycloak/keycloak-admin-client/lib/utils/auth"; import { merge } from "lodash-es"; class AdminClient { diff --git a/js/apps/admin-ui/tsconfig.json b/js/apps/admin-ui/tsconfig.json index e9d2c8d731f..56c74b91204 100644 --- a/js/apps/admin-ui/tsconfig.json +++ b/js/apps/admin-ui/tsconfig.json @@ -1,9 +1,6 @@ { - "extends": "../../tsconfig.json", + "extends": "../../../tsconfig.json", "include": ["src"], - "exclude": [ - "**/*.test.ts", - "**/*.test.tsx" - ], + "exclude": ["**/*.test.ts", "**/*.test.tsx"], "references": [{ "path": "./tsconfig.node.json" }] } diff --git a/js/libs/keycloak-admin-client/tsconfig.json b/js/libs/keycloak-admin-client/tsconfig.json index 27933244be5..c0932d4c75b 100644 --- a/js/libs/keycloak-admin-client/tsconfig.json +++ b/js/libs/keycloak-admin-client/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../tsconfig.json", + "extends": "../../../tsconfig.json", "include": ["src"], "compilerOptions": { "module": "Node16", @@ -8,4 +8,4 @@ "noEmit": false, "declaration": true } -} \ No newline at end of file +} diff --git a/js/libs/keycloak-masthead/tsconfig.json b/js/libs/keycloak-masthead/tsconfig.json index 600a5e80500..eeda960f6e2 100644 --- a/js/libs/keycloak-masthead/tsconfig.json +++ b/js/libs/keycloak-masthead/tsconfig.json @@ -1,8 +1,5 @@ { - "extends": "../../tsconfig.json", + "extends": "../../../tsconfig.json", "include": ["src"], - "exclude": [ - "**/*.test.ts", - "**/*.test.tsx" - ] -} \ No newline at end of file + "exclude": ["**/*.test.ts", "**/*.test.tsx"] +} diff --git a/js/libs/ui-shared/tsconfig.json b/js/libs/ui-shared/tsconfig.json index 600a5e80500..eeda960f6e2 100644 --- a/js/libs/ui-shared/tsconfig.json +++ b/js/libs/ui-shared/tsconfig.json @@ -1,8 +1,5 @@ { - "extends": "../../tsconfig.json", + "extends": "../../../tsconfig.json", "include": ["src"], - "exclude": [ - "**/*.test.ts", - "**/*.test.tsx" - ] -} \ No newline at end of file + "exclude": ["**/*.test.ts", "**/*.test.tsx"] +} diff --git a/js/lint-staged.config.js b/js/lint-staged.config.js deleted file mode 100644 index 2bc705881e4..00000000000 --- a/js/lint-staged.config.js +++ /dev/null @@ -1,8 +0,0 @@ -import path from "node:path"; - -const CONFIG_PATH = path.resolve(import.meta.dirname, "eslint.config.js"); - -export default { - "*.{js,jsx,mjs,ts,tsx}": (filenames) => - `eslint --config ${CONFIG_PATH} --cache --fix ${filenames.join(" ")}`, -}; diff --git a/package.json b/package.json index 5c2138a57cc..be0ba282f53 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "name": "root", "type": "module", + "packageManager": "pnpm@8.15.5", "scripts": { "prepare": "husky js/.husky" }, @@ -24,5 +25,7 @@ "typescript-eslint": "^7.6.0", "wireit": "^0.14.4" }, - "packageManager": "pnpm@8.15.5" + "lint-staged": { + "*.{js,jsx,mjs,ts,tsx}": "eslint --cache --fix" + } } diff --git a/js/tsconfig.eslint.json b/tsconfig.eslint.json similarity index 100% rename from js/tsconfig.eslint.json rename to tsconfig.eslint.json diff --git a/js/tsconfig.json b/tsconfig.json similarity index 95% rename from js/tsconfig.json rename to tsconfig.json index 6e75c3e5a9c..e1c1eccf7fb 100644 --- a/js/tsconfig.json +++ b/tsconfig.json @@ -15,6 +15,6 @@ "isolatedModules": true, "noEmit": true, "jsx": "react-jsx", - "baseUrl": "./", + "baseUrl": "./" } }