Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit 982a3d9

Browse files
committed
Merge remote-tracking branch 'origin/main' into feature/git-hooks
2 parents feb4a0c + 72b60fc commit 982a3d9

File tree

116 files changed

+19548
-11112
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+19548
-11112
lines changed

.env.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ VITE_AZURE_ACTIVE_DIRECTORY_CLIENT_ID="11111111-2222-3333-4444-555555555dev"
66
VITE_AZURE_ACTIVE_DIRECTORY_TENANT_ID="common"
77

88
# Optional for (local) development:
9+
NODE_ENV="development"
910

1011
# Opens Browser, e.g. "brave", "chrome" or "edge": https://vitejs.dev/config/#server-open
1112
# BROWSER="brave"

.eslintrc.js

Lines changed: 78 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -6,95 +6,107 @@ module.exports = {
66
worker: true,
77
},
88
extends: [
9-
'eslint:recommended',
10-
'plugin:@typescript-eslint/eslint-recommended',
11-
'plugin:@typescript-eslint/recommended',
12-
'plugin:react/recommended',
13-
'plugin:react/jsx-runtime',
14-
'plugin:import/recommended',
15-
'plugin:import/typescript',
16-
'plugin:jsx-a11y/recommended',
17-
'plugin:playwright/playwright-test',
18-
'plugin:sonarjs/recommended',
19-
'plugin:typescript-sort-keys/recommended',
9+
"eslint:recommended",
10+
"plugin:@typescript-eslint/eslint-recommended",
11+
"plugin:@typescript-eslint/recommended",
12+
"plugin:@typescript-eslint/recommended-requiring-type-checking",
13+
"plugin:@typescript-eslint/strict",
14+
"plugin:react/recommended",
15+
"plugin:react/jsx-runtime",
16+
"plugin:import/recommended",
17+
"plugin:import/typescript",
18+
"plugin:jsx-a11y/recommended",
19+
"plugin:playwright/playwright-test",
20+
"plugin:sonarjs/recommended",
21+
"plugin:typescript-sort-keys/recommended",
2022
// HINT: prettier must be the last extension to work
21-
'plugin:prettier/recommended',
23+
"plugin:prettier/recommended",
2224
],
23-
ignorePatterns: ['build', 'docker', 'node_modules', 'openshift', 'public'],
25+
ignorePatterns: ["build", "dev-dist", "dist", "docker", "node_modules", "openshift", "public"],
2426
overrides: [
2527
{
26-
files: ['*.ts', '*.tsx'],
28+
files: ["*.ts", "*.tsx"],
2729
rules: {
28-
'no-undef': 'off',
29-
'no-unused-vars': 'off',
30+
"no-undef": "off",
31+
"no-unused-vars": "off",
3032
},
3133
},
3234
],
33-
parser: '@typescript-eslint/parser',
35+
parser: "@typescript-eslint/parser",
36+
parserOptions: {
37+
project: ["./tsconfig.json"],
38+
tsconfigRootDir: __dirname,
39+
},
3440
plugins: [
35-
'@typescript-eslint',
36-
'jsx-a11y',
37-
'react-hooks',
38-
'react',
39-
'sonarjs',
40-
'sort-keys-fix',
41-
'typescript-sort-keys',
42-
'no-type-assertion',
41+
"@typescript-eslint",
42+
"jsx-a11y",
43+
"react-hooks",
44+
"react",
45+
"sonarjs",
46+
"sort-keys-fix",
47+
"typescript-sort-keys",
4348
// HINT: prettier must be the last plugin to work
44-
'prettier',
49+
"prettier",
4550
],
4651
rules: {
47-
'@typescript-eslint/no-unused-vars': [
48-
'warn',
52+
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
53+
"@typescript-eslint/no-floating-promises": ["error", { ignoreVoid: true }],
54+
"@typescript-eslint/no-misused-promises": [
55+
"error",
56+
{
57+
checksVoidReturn: false,
58+
},
59+
],
60+
"@typescript-eslint/no-unused-vars": [
61+
"warn",
4962
{
50-
argsIgnorePattern: '^_',
51-
caughtErrorsIgnorePattern: '^_',
52-
varsIgnorePattern: '^_',
63+
argsIgnorePattern: "^_",
64+
caughtErrorsIgnorePattern: "^_",
65+
varsIgnorePattern: "^_",
5366
},
5467
],
55-
'@typescript-eslint/sort-type-union-intersection-members': 'error',
56-
camelcase: 'warn',
57-
curly: 'error',
58-
'import/no-unused-modules': [
59-
'error',
68+
"@typescript-eslint/sort-type-union-intersection-members": "error",
69+
camelcase: "warn",
70+
curly: "error",
71+
"import/no-unused-modules": [
72+
"error",
6073
{
6174
ignoreExports: [
62-
'playwright/index.ts',
63-
'src/index.tsx',
64-
'src/**/*.d.ts',
65-
'src/**/*.{spec,test}.{ts,tsx}',
66-
'*.{js,ts}', // mostly configuration files
75+
"playwright/index.ts",
76+
"src/index.tsx",
77+
"src/**/*.d.ts",
78+
"src/**/*.{spec,test}.{ts,tsx}",
79+
"*.{js,ts}", // mostly configuration files
6780
],
6881
missingExports: true,
69-
src: ['.'],
82+
src: ["."],
7083
unusedExports: true,
7184
},
7285
],
73-
'import/order': [
74-
'error',
86+
"import/order": [
87+
"error",
7588
{
7689
alphabetize: {
7790
caseInsensitive: true,
78-
order: 'asc',
91+
order: "asc",
7992
},
80-
groups: ['builtin', 'external', 'internal'],
93+
groups: ["builtin", "external", "internal"],
8194
pathGroups: [
8295
{
83-
group: 'external',
84-
pattern: 'react',
85-
position: 'before',
96+
group: "external",
97+
pattern: "react",
98+
position: "before",
8699
},
87100
],
88-
pathGroupsExcludedImportTypes: ['react'],
101+
pathGroupsExcludedImportTypes: ["react"],
89102
},
90103
],
91-
'import/prefer-default-export': 'off',
92-
'no-console': ['warn', { allow: ['warn', 'error'] }],
93-
'no-type-assertion/no-type-assertion': 'error',
94-
'prettier/prettier': 'error',
95-
'react/jsx-sort-default-props': 'error',
96-
'react/jsx-sort-props': [
97-
'error',
104+
"import/prefer-default-export": "off",
105+
"no-console": ["warn", { allow: ["warn", "error"] }],
106+
"prettier/prettier": "error",
107+
"react/jsx-sort-default-props": "error",
108+
"react/jsx-sort-props": [
109+
"error",
98110
{
99111
callbacksLast: true,
100112
ignoreCase: true,
@@ -104,34 +116,34 @@ module.exports = {
104116
shorthandLast: false,
105117
},
106118
],
107-
'react-hooks/exhaustive-deps': 'error',
108-
'react-hooks/rules-of-hooks': 'error',
109-
'sort-imports': [
110-
'error',
119+
"react-hooks/exhaustive-deps": "error",
120+
"react-hooks/rules-of-hooks": "error",
121+
"sort-imports": [
122+
"error",
111123
{
112124
ignoreCase: true,
113125
ignoreDeclarationSort: true,
114126
ignoreMemberSort: false,
115127
},
116128
],
117129
// Required to fix sort-keys automatically, since this is not done by default.
118-
'sort-keys-fix/sort-keys-fix': [
119-
'error',
120-
'asc',
130+
"sort-keys-fix/sort-keys-fix": [
131+
"error",
132+
"asc",
121133
{
122134
caseSensitive: false,
123135
natural: true,
124136
},
125137
],
126138
},
127139
settings: {
128-
'import/resolver': {
140+
"import/resolver": {
129141
typescript: {
130142
alwaysTryTypes: true,
131143
},
132144
},
133145
react: {
134-
version: 'detect',
146+
version: "detect",
135147
},
136148
},
137149
};
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Build and Test
2+
on:
3+
push:
4+
branches-ignore:
5+
- 'main'
6+
7+
jobs:
8+
build_and_test:
9+
name: 'Build and Test'
10+
runs-on: ubuntu-20.04
11+
container:
12+
# Using the playwright container (https://mcr.microsoft.com/product/playwright/about)
13+
# for performance reasons to avoid having to download and install all dependencies again.
14+
image: mcr.microsoft.com/playwright:v1.27.1-focal
15+
# Container should run with the same user of the host VM, otherwise it leads to permission issues
16+
# see: https://github.com/actions/runner/issues/691 & https://github.com/actions/checkout/issues/211#issuecomment-680107607
17+
options: --user 1001
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v3
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v3
23+
with:
24+
node-version-file: '.nvmrc'
25+
cache: 'npm'
26+
cache-dependency-path: '**/package-lock.json'
27+
# Ignore README.md from find results to avoid unintentionally changes on the release step
28+
- name: Setup Quickstarter (Project ID)
29+
run: find . -type f \( ! -name "README.md" \) -exec sed -i 's/PROJECTID/foo/g' {} +
30+
# Ignore README.md from find results to avoid unintentionally changes on the release step
31+
- name: Setup Quickstarter (Component ID)
32+
run: find . -type f \( ! -name "README.md" \) -exec sed -i 's/COMPONENTID/app/g' {} +
33+
- name: Install Dependencies
34+
run: npm ci
35+
- name: Analyze Code - Check ESLint Rules
36+
run: npm run lint
37+
- name: Test Components
38+
env:
39+
VITE_AZURE_ACTIVE_DIRECTORY_CLIENT_ID: '11111111-2222-3333-4444-555555555dev'
40+
# IMPORTANT: A valid Azure AD Tenant ID for testing purposes is required.
41+
VITE_AZURE_ACTIVE_DIRECTORY_TENANT_ID: 'common'
42+
run: npm run test
43+
- name: Build Application
44+
run: npm run build

.github/workflows/release.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,16 @@ jobs:
99
# Disable husky (git hooks) in CI, see: https://typicode.github.io/husky/#/?id=disable-husky-in-cidocker
1010
HUSKY: 0
1111
name: Release
12-
runs-on: ubuntu-latest
12+
runs-on: ubuntu-20.04
1313
steps:
1414
- name: Checkout
15-
uses: actions/checkout@v2
15+
uses: actions/checkout@v3
1616
- name: Setup Node.js
17-
uses: actions/setup-node@v2
17+
uses: actions/setup-node@v3
1818
with:
19-
node-version: 'lts/*'
19+
node-version-file: '.nvmrc'
20+
cache: 'npm'
21+
cache-dependency-path: '**/package-lock.json'
2022
# Ignore README.md from find results to avoid unintentionally changes on the release step
2123
- name: Setup Quickstarter (Project ID)
2224
run: find . -type f \( ! -name "README.md" \) -exec sed -i 's/PROJECTID/foo/g' {} +

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@
1111
/playwright/.cache/
1212
/test-results/
1313

14+
# development
15+
/dev-dist
16+
1417
# production
1518
/build
1619
/dist
1720
/docker/build
21+
/docker/dist
1822

1923
# misc
2024
.DS_Store

.husky/commit-msg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/usr/bin/env sh
22
. "$(dirname -- "$0")/_/husky.sh"
33

4-
npx --no -- commitlint --edit "$1" || { echo "Try \033[1;32mnpx git-cz --disable-emoji\033[0;37m to commit and be align with the conventions or use \033[1;32git commit -m \"yolo!\" --no-verify\033[0;37m to bypass the commit-msg hook."; exit 1; }
4+
npx --no -- commitlint --edit "$1" || { echo "Try \033[1;32mnpx git-cz --disable-emoji\033[0;37m to commit and be align with the conventions or use \033[1;33mgit commit -m \"yolo!\" --no-verify\033[0;37m to bypass the commit-msg hook."; exit 1; }

.husky/pre-commit

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
#!/usr/bin/env sh
22
. "$(dirname -- "$0")/_/husky.sh"
33

4+
# The (feature) branch name is part of the helm release name and only supports a maximum number of characters.
5+
# The number is unknown for the moment, since it's also depends on Project Id and Component Id.
6+
# However, the recommendation is that the branch name should not be longer than 32 characters.
7+
BRANCH_NAME_LENGTH=$(git branch --show-current | wc -m)
8+
BRANCH_NAME_MAX_LENGTH=32
9+
if [ $BRANCH_NAME_LENGTH -gt $BRANCH_NAME_MAX_LENGTH ]
10+
then
11+
echo "\033[1;31m✖ Branch name too long ($((BRANCH_NAME_LENGTH))), only $((BRANCH_NAME_MAX_LENGTH)) characters are allowed. Change with 'git branch -m \"new-name\"'\033[0m" && exit;
12+
fi
13+
414
npx --no lint-staged
515
helm lint chart --strict

.lintstagedrc.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
module.exports = {
22
'*.css': ['stylelint --fix', 'git add --force'],
3-
'*.{js,jsx,ts,tsx}': [
4-
// Extend rule levels based on .eslintrc.js
5-
"eslint --fix --rule '@typescript-eslint/no-unused-vars: error' --rule 'no-console: error'",
3+
'*.{js,jsx}': [
4+
// Extend rule set of .eslintrc.js with 'no-console' and 'no-unused-vars'
5+
"eslint --fix --rule 'no-console: [error, { allow: [warn, error] }]' --rule 'no-unused-vars: error'",
6+
'git add --force',
7+
],
8+
'*.{ts,tsx}': [
9+
// Extend rule set of .eslintrc.js with 'no-console' and '@typescript-eslint/no-unused-vars'
10+
"eslint --fix --rule 'no-console: [error, { allow: [warn, error] }]' --rule '@typescript-eslint/no-unused-vars: [error, { argsIgnorePattern: ^_, caughtErrorsIgnorePattern: ^_, varsIgnorePattern: ^_, }]'",
611
'git add --force',
712
],
813
'*.json': ['prettier --write', 'git add --force'],

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@
99
# strict-ssl = false
1010

1111
registry = https://registry.npmjs.org/
12+
save-exact = true
1213
strict-ssl = true

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
lts/*
1+
v18

0 commit comments

Comments
 (0)