From 8accf1fdb7f943f9bae36a2591eea13025ba8c1b Mon Sep 17 00:00:00 2001 From: Martin Benedikt Busch Date: Wed, 7 Feb 2024 16:01:03 +0100 Subject: [PATCH 01/14] implement formating consistent with backend --- .prettierrc | 7 ------- .prettierrc.cjs | 6 ++++++ package.json | 6 +++--- 3 files changed, 9 insertions(+), 10 deletions(-) delete mode 100644 .prettierrc create mode 100644 .prettierrc.cjs diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index 57737524..00000000 --- a/.prettierrc +++ /dev/null @@ -1,7 +0,0 @@ -{ - "printWidth": 100, - "trailingComma": "es5", - "tabWidth": 2, - "semi": true, - "singleQuote": true -} diff --git a/.prettierrc.cjs b/.prettierrc.cjs new file mode 100644 index 00000000..c920e99b --- /dev/null +++ b/.prettierrc.cjs @@ -0,0 +1,6 @@ +module.exports = { + tabWidth: 2, + singleQuote: true, + quoteProps: 'consistent', + printWidth: 100, +}; \ No newline at end of file diff --git a/package.json b/package.json index 1755631f..165c91d3 100644 --- a/package.json +++ b/package.json @@ -7,13 +7,13 @@ "core:dev": "pnpm -r --filter core dev", "core:build": "pnpm -r --filter core build", "core:lint": "pnpm -r --filter core lint", - "core:format": "pnpm -r --filter core format", "core:preview": "pnpm -r --filter core preview", "berlin:dev": "pnpm -r --filter berlin dev", "berlin:build": "pnpm -r --filter berlin build", "berlin:lint": "pnpm -r --filter berlin lint", - "berlin:format": "pnpm -r --filter berlin format", - "berlin:preview": "pnpm -r --filter berlin preview" + "berlin:preview": "pnpm -r --filter berlin preview", + "format": "prettier --check \"packages/**/*.{ts,md}\"", + "format:fix": "prettier --write \"packages/**/*.{ts,md}\"" }, "dependencies": { "@hookform/resolvers": "^3.3.4", From e6cbfa01e1506c72c0ba27035bc578f4dbcfada1 Mon Sep 17 00:00:00 2001 From: Martin Benedikt Busch Date: Wed, 7 Feb 2024 16:22:21 +0100 Subject: [PATCH 02/14] implement linter consistent with backend --- .eslintignore | 3 ++ .eslintrc.cjs | 13 ++++--- package.json | 8 +++-- pnpm-lock.yaml | 96 ++++++++++++++++++++++++++++---------------------- 4 files changed, 71 insertions(+), 49 deletions(-) create mode 100644 .eslintignore diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 00000000..9ee7f74e --- /dev/null +++ b/.eslintignore @@ -0,0 +1,3 @@ +# exclude .js files from linting +/dist/ +.eslintrc.cjs \ No newline at end of file diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 63c35802..a4622ee3 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -1,16 +1,21 @@ module.exports = { - root: true, - env: { browser: true, es2020: true }, extends: [ 'eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:react-hooks/recommended', 'plugin:@tanstack/eslint-plugin-query/recommended', + 'prettier' ], - ignorePatterns: ['dist', '.eslintrc.cjs'], parser: '@typescript-eslint/parser', - plugins: ['react-refresh'], + plugins: ['react-refresh', '@typescript-eslint'], + root: true, rules: { 'react-refresh/only-export-components': ['warn', { allowConstantExport: true }], + '@typescript-eslint/ban-ts-comment': 'warn', + '@typescript-eslint/no-var-requires': 'off', + '@typescript-eslint/no-unused-vars': [ + 'warn', + { argsIgnorePattern: '^_', varsIgnorePattern: '^_ignored', ignoreRestSiblings: true }, + ], }, }; diff --git a/package.json b/package.json index 165c91d3..eb8549d4 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,8 @@ "berlin:lint": "pnpm -r --filter berlin lint", "berlin:preview": "pnpm -r --filter berlin preview", "format": "prettier --check \"packages/**/*.{ts,md}\"", - "format:fix": "prettier --write \"packages/**/*.{ts,md}\"" + "format:fix": "prettier --write \"packages/**/*.{ts,md}\"", + "lint": "eslint ." }, "dependencies": { "@hookform/resolvers": "^3.3.4", @@ -39,10 +40,11 @@ "@typescript-eslint/eslint-plugin": "^6.10.0", "@typescript-eslint/parser": "^6.10.0", "@vitejs/plugin-react": "^4.2.0", - "eslint": "^8.53.0", + "eslint": "^8.56.0", + "eslint-config-prettier": "^9.1.0", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-refresh": "^0.4.4", - "prettier": "3.1.0", + "prettier": "^3.1.1", "typescript": "^5.2.2", "vite": "^5.0.0", "vite-plugin-node-polyfills": "^0.17.0" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8fd9d5cf..7ddd83a4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -56,7 +56,7 @@ importers: devDependencies: '@tanstack/eslint-plugin-query': specifier: ^5.18.0 - version: 5.18.1(eslint@8.55.0)(typescript@5.3.3) + version: 5.18.1(eslint@8.56.0)(typescript@5.3.3) '@types/react': specifier: ^18.2.37 version: 18.2.42 @@ -65,25 +65,28 @@ importers: version: 18.2.17 '@typescript-eslint/eslint-plugin': specifier: ^6.10.0 - version: 6.13.2(@typescript-eslint/parser@6.13.2)(eslint@8.55.0)(typescript@5.3.3) + version: 6.13.2(@typescript-eslint/parser@6.13.2)(eslint@8.56.0)(typescript@5.3.3) '@typescript-eslint/parser': specifier: ^6.10.0 - version: 6.13.2(eslint@8.55.0)(typescript@5.3.3) + version: 6.13.2(eslint@8.56.0)(typescript@5.3.3) '@vitejs/plugin-react': specifier: ^4.2.0 version: 4.2.1(vite@5.0.6) eslint: - specifier: ^8.53.0 - version: 8.55.0 + specifier: ^8.56.0 + version: 8.56.0 + eslint-config-prettier: + specifier: ^9.1.0 + version: 9.1.0(eslint@8.56.0) eslint-plugin-react-hooks: specifier: ^4.6.0 - version: 4.6.0(eslint@8.55.0) + version: 4.6.0(eslint@8.56.0) eslint-plugin-react-refresh: specifier: ^0.4.4 - version: 0.4.5(eslint@8.55.0) + version: 0.4.5(eslint@8.56.0) prettier: - specifier: 3.1.0 - version: 3.1.0 + specifier: ^3.1.1 + version: 3.2.5 typescript: specifier: ^5.2.2 version: 5.3.3 @@ -553,13 +556,13 @@ packages: dev: true optional: true - /@eslint-community/eslint-utils@4.4.0(eslint@8.55.0): + /@eslint-community/eslint-utils@4.4.0(eslint@8.56.0): resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 dependencies: - eslint: 8.55.0 + eslint: 8.56.0 eslint-visitor-keys: 3.4.3 dev: true @@ -585,8 +588,8 @@ packages: - supports-color dev: true - /@eslint/js@8.55.0: - resolution: {integrity: sha512-qQfo2mxH5yVom1kacMtZZJFVdW+E70mqHMJvVg6WTLo+VBuQJ4TojZlfWBjK0ve5BdEeNAVxOsl/nvNMpJOaJA==} + /@eslint/js@8.56.0: + resolution: {integrity: sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true @@ -1426,13 +1429,13 @@ packages: '@zk-kit/incremental-merkle-tree': 0.4.3 dev: false - /@tanstack/eslint-plugin-query@5.18.1(eslint@8.55.0)(typescript@5.3.3): + /@tanstack/eslint-plugin-query@5.18.1(eslint@8.56.0)(typescript@5.3.3): resolution: {integrity: sha512-pLHqd2RYSbGxhFXdjVxo5Gmi1aJfcXDpZQsjLHEkGEXFb65WzX6LMCz7n2rW3wBElDerRLFZNVLC61Pg/TlYsA==} peerDependencies: eslint: ^8.0.0 dependencies: - '@typescript-eslint/utils': 5.62.0(eslint@8.55.0)(typescript@5.3.3) - eslint: 8.55.0 + '@typescript-eslint/utils': 5.62.0(eslint@8.56.0)(typescript@5.3.3) + eslint: 8.56.0 transitivePeerDependencies: - supports-color - typescript @@ -1530,7 +1533,7 @@ packages: resolution: {integrity: sha512-36ZrGJ8fgtBr6nwNnuJ9jXIj+bn/pF6UoqmrQT7+Y99+tFFeHHsoR54+194dHdyhPjgbeoNz3Qru0oRt0l6ASQ==} dev: false - /@typescript-eslint/eslint-plugin@6.13.2(@typescript-eslint/parser@6.13.2)(eslint@8.55.0)(typescript@5.3.3): + /@typescript-eslint/eslint-plugin@6.13.2(@typescript-eslint/parser@6.13.2)(eslint@8.56.0)(typescript@5.3.3): resolution: {integrity: sha512-3+9OGAWHhk4O1LlcwLBONbdXsAhLjyCFogJY/cWy2lxdVJ2JrcTF2pTGMaLl2AE7U1l31n8Py4a8bx5DLf/0dQ==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: @@ -1542,13 +1545,13 @@ packages: optional: true dependencies: '@eslint-community/regexpp': 4.10.0 - '@typescript-eslint/parser': 6.13.2(eslint@8.55.0)(typescript@5.3.3) + '@typescript-eslint/parser': 6.13.2(eslint@8.56.0)(typescript@5.3.3) '@typescript-eslint/scope-manager': 6.13.2 - '@typescript-eslint/type-utils': 6.13.2(eslint@8.55.0)(typescript@5.3.3) - '@typescript-eslint/utils': 6.13.2(eslint@8.55.0)(typescript@5.3.3) + '@typescript-eslint/type-utils': 6.13.2(eslint@8.56.0)(typescript@5.3.3) + '@typescript-eslint/utils': 6.13.2(eslint@8.56.0)(typescript@5.3.3) '@typescript-eslint/visitor-keys': 6.13.2 debug: 4.3.4(supports-color@5.5.0) - eslint: 8.55.0 + eslint: 8.56.0 graphemer: 1.4.0 ignore: 5.3.0 natural-compare: 1.4.0 @@ -1559,7 +1562,7 @@ packages: - supports-color dev: true - /@typescript-eslint/parser@6.13.2(eslint@8.55.0)(typescript@5.3.3): + /@typescript-eslint/parser@6.13.2(eslint@8.56.0)(typescript@5.3.3): resolution: {integrity: sha512-MUkcC+7Wt/QOGeVlM8aGGJZy1XV5YKjTpq9jK6r6/iLsGXhBVaGP5N0UYvFsu9BFlSpwY9kMretzdBH01rkRXg==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: @@ -1574,7 +1577,7 @@ packages: '@typescript-eslint/typescript-estree': 6.13.2(typescript@5.3.3) '@typescript-eslint/visitor-keys': 6.13.2 debug: 4.3.4(supports-color@5.5.0) - eslint: 8.55.0 + eslint: 8.56.0 typescript: 5.3.3 transitivePeerDependencies: - supports-color @@ -1596,7 +1599,7 @@ packages: '@typescript-eslint/visitor-keys': 6.13.2 dev: true - /@typescript-eslint/type-utils@6.13.2(eslint@8.55.0)(typescript@5.3.3): + /@typescript-eslint/type-utils@6.13.2(eslint@8.56.0)(typescript@5.3.3): resolution: {integrity: sha512-Qr6ssS1GFongzH2qfnWKkAQmMUyZSyOr0W54nZNU1MDfo+U4Mv3XveeLZzadc/yq8iYhQZHYT+eoXJqnACM1tw==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: @@ -1607,9 +1610,9 @@ packages: optional: true dependencies: '@typescript-eslint/typescript-estree': 6.13.2(typescript@5.3.3) - '@typescript-eslint/utils': 6.13.2(eslint@8.55.0)(typescript@5.3.3) + '@typescript-eslint/utils': 6.13.2(eslint@8.56.0)(typescript@5.3.3) debug: 4.3.4(supports-color@5.5.0) - eslint: 8.55.0 + eslint: 8.56.0 ts-api-utils: 1.0.3(typescript@5.3.3) typescript: 5.3.3 transitivePeerDependencies: @@ -1668,19 +1671,19 @@ packages: - supports-color dev: true - /@typescript-eslint/utils@5.62.0(eslint@8.55.0)(typescript@5.3.3): + /@typescript-eslint/utils@5.62.0(eslint@8.56.0)(typescript@5.3.3): resolution: {integrity: sha512-n8oxjeb5aIbPFEtmQxQYOLI0i9n5ySBEY/ZEHHZqKQSFnxio1rv6dthascc9dLuwrL0RC5mPCxB7vnAVGAYWAQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.55.0) + '@eslint-community/eslint-utils': 4.4.0(eslint@8.56.0) '@types/json-schema': 7.0.15 '@types/semver': 7.5.6 '@typescript-eslint/scope-manager': 5.62.0 '@typescript-eslint/types': 5.62.0 '@typescript-eslint/typescript-estree': 5.62.0(typescript@5.3.3) - eslint: 8.55.0 + eslint: 8.56.0 eslint-scope: 5.1.1 semver: 7.5.4 transitivePeerDependencies: @@ -1688,19 +1691,19 @@ packages: - typescript dev: true - /@typescript-eslint/utils@6.13.2(eslint@8.55.0)(typescript@5.3.3): + /@typescript-eslint/utils@6.13.2(eslint@8.56.0)(typescript@5.3.3): resolution: {integrity: sha512-b9Ptq4eAZUym4idijCRzl61oPCwwREcfDI8xGk751Vhzig5fFZR9CyzDz4Sp/nxSLBYxUPyh4QdIDqWykFhNmQ==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: eslint: ^7.0.0 || ^8.0.0 dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.55.0) + '@eslint-community/eslint-utils': 4.4.0(eslint@8.56.0) '@types/json-schema': 7.0.15 '@types/semver': 7.5.6 '@typescript-eslint/scope-manager': 6.13.2 '@typescript-eslint/types': 6.13.2 '@typescript-eslint/typescript-estree': 6.13.2(typescript@5.3.3) - eslint: 8.55.0 + eslint: 8.56.0 semver: 7.5.4 transitivePeerDependencies: - supports-color @@ -2342,21 +2345,30 @@ packages: engines: {node: '>=10'} dev: true - /eslint-plugin-react-hooks@4.6.0(eslint@8.55.0): + /eslint-config-prettier@9.1.0(eslint@8.56.0): + resolution: {integrity: sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==} + hasBin: true + peerDependencies: + eslint: '>=7.0.0' + dependencies: + eslint: 8.56.0 + dev: true + + /eslint-plugin-react-hooks@4.6.0(eslint@8.56.0): resolution: {integrity: sha512-oFc7Itz9Qxh2x4gNHStv3BqJq54ExXmfC+a1NjAta66IAN87Wu0R/QArgIS9qKzX3dXKPI9H5crl9QchNMY9+g==} engines: {node: '>=10'} peerDependencies: eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 dependencies: - eslint: 8.55.0 + eslint: 8.56.0 dev: true - /eslint-plugin-react-refresh@0.4.5(eslint@8.55.0): + /eslint-plugin-react-refresh@0.4.5(eslint@8.56.0): resolution: {integrity: sha512-D53FYKJa+fDmZMtriODxvhwrO+IOqrxoEo21gMA0sjHdU6dPVH4OhyFip9ypl8HOF5RV5KdTo+rBQLvnY2cO8w==} peerDependencies: eslint: '>=7' dependencies: - eslint: 8.55.0 + eslint: 8.56.0 dev: true /eslint-scope@5.1.1: @@ -2380,15 +2392,15 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /eslint@8.55.0: - resolution: {integrity: sha512-iyUUAM0PCKj5QpwGfmCAG9XXbZCWsqP/eWAWrG/W0umvjuLRBECwSFdt+rCntju0xEH7teIABPwXpahftIaTdA==} + /eslint@8.56.0: + resolution: {integrity: sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} hasBin: true dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.55.0) + '@eslint-community/eslint-utils': 4.4.0(eslint@8.56.0) '@eslint-community/regexpp': 4.10.0 '@eslint/eslintrc': 2.1.4 - '@eslint/js': 8.55.0 + '@eslint/js': 8.56.0 '@humanwhocodes/config-array': 0.11.13 '@humanwhocodes/module-importer': 1.0.1 '@nodelib/fs.walk': 1.2.8 @@ -3278,8 +3290,8 @@ packages: engines: {node: '>= 0.8.0'} dev: true - /prettier@3.1.0: - resolution: {integrity: sha512-TQLvXjq5IAibjh8EpBIkNKxO749UEWABoiIZehEPiY4GNpVdhaFKqSTu+QrlU6D2dPAfubRmtJTi4K4YkQ5eXw==} + /prettier@3.2.5: + resolution: {integrity: sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==} engines: {node: '>=14'} hasBin: true dev: true From e718652ee7ac4363d1b94e4a8e931e4e2745f94a Mon Sep 17 00:00:00 2001 From: Martin Benedikt Busch Date: Wed, 7 Feb 2024 16:37:56 +0100 Subject: [PATCH 03/14] implement formating and linting workflows --- .github/workflows/check-formatting.yml | 35 +++++++++++++++++++++++++ .github/workflows/lint.yml | 36 ++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 .github/workflows/check-formatting.yml create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/check-formatting.yml b/.github/workflows/check-formatting.yml new file mode 100644 index 00000000..d4c8c816 --- /dev/null +++ b/.github/workflows/check-formatting.yml @@ -0,0 +1,35 @@ +name: Check Formatting + +on: + pull_request: + types: [opened, synchronize, reopened] + branches: + - develop + - main + +concurrency: + # group runs by -- + group: ${{ github.workflow }}-${{ github.job }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + formatting: + name: Check formatting + timeout-minutes: 2 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v2 + with: + version: 8 + - name: Setup Node.js environment + uses: actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + cache: 'pnpm' + + - name: Install dependencies + run: pnpm install + + - name: Review formatting + run: pnpm format \ No newline at end of file diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..cab3377c --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,36 @@ +name: Linting + +on: + pull_request: + types: [opened, synchronize, reopened] + branches: + - develop + - main + +concurrency: + # group runs by -- + group: ${{ github.workflow }}-${{ github.job }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + linting: + name: Check linting + timeout-minutes: 2 + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v2 + with: + version: 8 + - name: Setup Node.js environment + uses: actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + cache: 'pnpm' + + - name: Install dependencies + run: pnpm install + + - name: Review linting + run: pnpm lint From 791d29f758f68864e535e77e5f097d6627996102 Mon Sep 17 00:00:00 2001 From: Martin Benedikt Busch Date: Wed, 7 Feb 2024 16:47:45 +0100 Subject: [PATCH 04/14] require node v20 --- .nvmrc | 1 + package.json | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 .nvmrc diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 00000000..85aee5a5 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v20 \ No newline at end of file diff --git a/package.json b/package.json index eb8549d4..5e79d438 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,12 @@ "format:fix": "prettier --write \"packages/**/*.{ts,md}\"", "lint": "eslint ." }, + "keywords": [], + "author": "", + "license": "ISC", + "engines": { + "node": "^20" + }, "dependencies": { "@hookform/resolvers": "^3.3.4", "@pcd/passport-interface": "^0.8.0", From 7205526bfaa2b3a94f6cb3d081eafba431f338d4 Mon Sep 17 00:00:00 2001 From: Martin Benedikt Busch Date: Wed, 7 Feb 2024 17:07:54 +0100 Subject: [PATCH 05/14] update dependencies --- package.json | 4 +-- pnpm-lock.yaml | 92 +++++++++++++++++++++++++++++--------------------- 2 files changed, 55 insertions(+), 41 deletions(-) diff --git a/package.json b/package.json index 5e79d438..da9754f4 100644 --- a/package.json +++ b/package.json @@ -43,8 +43,8 @@ "@tanstack/eslint-plugin-query": "^5.18.0", "@types/react": "^18.2.37", "@types/react-dom": "^18.2.15", - "@typescript-eslint/eslint-plugin": "^6.10.0", - "@typescript-eslint/parser": "^6.10.0", + "@typescript-eslint/eslint-plugin": "^6.19.0", + "@typescript-eslint/parser": "^6.19.0", "@vitejs/plugin-react": "^4.2.0", "eslint": "^8.56.0", "eslint-config-prettier": "^9.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7ddd83a4..39ba1794 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -64,11 +64,11 @@ importers: specifier: ^18.2.15 version: 18.2.17 '@typescript-eslint/eslint-plugin': - specifier: ^6.10.0 - version: 6.13.2(@typescript-eslint/parser@6.13.2)(eslint@8.56.0)(typescript@5.3.3) + specifier: ^6.19.0 + version: 6.21.0(@typescript-eslint/parser@6.21.0)(eslint@8.56.0)(typescript@5.3.3) '@typescript-eslint/parser': - specifier: ^6.10.0 - version: 6.13.2(eslint@8.56.0)(typescript@5.3.3) + specifier: ^6.19.0 + version: 6.21.0(eslint@8.56.0)(typescript@5.3.3) '@vitejs/plugin-react': specifier: ^4.2.0 version: 4.2.1(vite@5.0.6) @@ -1533,8 +1533,8 @@ packages: resolution: {integrity: sha512-36ZrGJ8fgtBr6nwNnuJ9jXIj+bn/pF6UoqmrQT7+Y99+tFFeHHsoR54+194dHdyhPjgbeoNz3Qru0oRt0l6ASQ==} dev: false - /@typescript-eslint/eslint-plugin@6.13.2(@typescript-eslint/parser@6.13.2)(eslint@8.56.0)(typescript@5.3.3): - resolution: {integrity: sha512-3+9OGAWHhk4O1LlcwLBONbdXsAhLjyCFogJY/cWy2lxdVJ2JrcTF2pTGMaLl2AE7U1l31n8Py4a8bx5DLf/0dQ==} + /@typescript-eslint/eslint-plugin@6.21.0(@typescript-eslint/parser@6.21.0)(eslint@8.56.0)(typescript@5.3.3): + resolution: {integrity: sha512-oy9+hTPCUFpngkEZUSzbf9MxI65wbKFoQYsgPdILTfbUldp5ovUuphZVe4i30emU9M/kP+T64Di0mxl7dSw3MA==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: '@typescript-eslint/parser': ^6.0.0 || ^6.0.0-alpha @@ -1545,11 +1545,11 @@ packages: optional: true dependencies: '@eslint-community/regexpp': 4.10.0 - '@typescript-eslint/parser': 6.13.2(eslint@8.56.0)(typescript@5.3.3) - '@typescript-eslint/scope-manager': 6.13.2 - '@typescript-eslint/type-utils': 6.13.2(eslint@8.56.0)(typescript@5.3.3) - '@typescript-eslint/utils': 6.13.2(eslint@8.56.0)(typescript@5.3.3) - '@typescript-eslint/visitor-keys': 6.13.2 + '@typescript-eslint/parser': 6.21.0(eslint@8.56.0)(typescript@5.3.3) + '@typescript-eslint/scope-manager': 6.21.0 + '@typescript-eslint/type-utils': 6.21.0(eslint@8.56.0)(typescript@5.3.3) + '@typescript-eslint/utils': 6.21.0(eslint@8.56.0)(typescript@5.3.3) + '@typescript-eslint/visitor-keys': 6.21.0 debug: 4.3.4(supports-color@5.5.0) eslint: 8.56.0 graphemer: 1.4.0 @@ -1562,8 +1562,8 @@ packages: - supports-color dev: true - /@typescript-eslint/parser@6.13.2(eslint@8.56.0)(typescript@5.3.3): - resolution: {integrity: sha512-MUkcC+7Wt/QOGeVlM8aGGJZy1XV5YKjTpq9jK6r6/iLsGXhBVaGP5N0UYvFsu9BFlSpwY9kMretzdBH01rkRXg==} + /@typescript-eslint/parser@6.21.0(eslint@8.56.0)(typescript@5.3.3): + resolution: {integrity: sha512-tbsV1jPne5CkFQCgPBcDOt30ItF7aJoZL997JSF7MhGQqOeT3svWRYxiqlfA5RUdlHN6Fi+EI9bxqbdyAUZjYQ==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: eslint: ^7.0.0 || ^8.0.0 @@ -1572,10 +1572,10 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/scope-manager': 6.13.2 - '@typescript-eslint/types': 6.13.2 - '@typescript-eslint/typescript-estree': 6.13.2(typescript@5.3.3) - '@typescript-eslint/visitor-keys': 6.13.2 + '@typescript-eslint/scope-manager': 6.21.0 + '@typescript-eslint/types': 6.21.0 + '@typescript-eslint/typescript-estree': 6.21.0(typescript@5.3.3) + '@typescript-eslint/visitor-keys': 6.21.0 debug: 4.3.4(supports-color@5.5.0) eslint: 8.56.0 typescript: 5.3.3 @@ -1591,16 +1591,16 @@ packages: '@typescript-eslint/visitor-keys': 5.62.0 dev: true - /@typescript-eslint/scope-manager@6.13.2: - resolution: {integrity: sha512-CXQA0xo7z6x13FeDYCgBkjWzNqzBn8RXaE3QVQVIUm74fWJLkJkaHmHdKStrxQllGh6Q4eUGyNpMe0b1hMkXFA==} + /@typescript-eslint/scope-manager@6.21.0: + resolution: {integrity: sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==} engines: {node: ^16.0.0 || >=18.0.0} dependencies: - '@typescript-eslint/types': 6.13.2 - '@typescript-eslint/visitor-keys': 6.13.2 + '@typescript-eslint/types': 6.21.0 + '@typescript-eslint/visitor-keys': 6.21.0 dev: true - /@typescript-eslint/type-utils@6.13.2(eslint@8.56.0)(typescript@5.3.3): - resolution: {integrity: sha512-Qr6ssS1GFongzH2qfnWKkAQmMUyZSyOr0W54nZNU1MDfo+U4Mv3XveeLZzadc/yq8iYhQZHYT+eoXJqnACM1tw==} + /@typescript-eslint/type-utils@6.21.0(eslint@8.56.0)(typescript@5.3.3): + resolution: {integrity: sha512-rZQI7wHfao8qMX3Rd3xqeYSMCL3SoiSQLBATSiVKARdFGCYSRvmViieZjqc58jKgs8Y8i9YvVVhRbHSTA4VBag==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: eslint: ^7.0.0 || ^8.0.0 @@ -1609,8 +1609,8 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/typescript-estree': 6.13.2(typescript@5.3.3) - '@typescript-eslint/utils': 6.13.2(eslint@8.56.0)(typescript@5.3.3) + '@typescript-eslint/typescript-estree': 6.21.0(typescript@5.3.3) + '@typescript-eslint/utils': 6.21.0(eslint@8.56.0)(typescript@5.3.3) debug: 4.3.4(supports-color@5.5.0) eslint: 8.56.0 ts-api-utils: 1.0.3(typescript@5.3.3) @@ -1624,8 +1624,8 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /@typescript-eslint/types@6.13.2: - resolution: {integrity: sha512-7sxbQ+EMRubQc3wTfTsycgYpSujyVbI1xw+3UMRUcrhSy+pN09y/lWzeKDbvhoqcRbHdc+APLs/PWYi/cisLPg==} + /@typescript-eslint/types@6.21.0: + resolution: {integrity: sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==} engines: {node: ^16.0.0 || >=18.0.0} dev: true @@ -1650,8 +1650,8 @@ packages: - supports-color dev: true - /@typescript-eslint/typescript-estree@6.13.2(typescript@5.3.3): - resolution: {integrity: sha512-SuD8YLQv6WHnOEtKv8D6HZUzOub855cfPnPMKvdM/Bh1plv1f7Q/0iFUDLKKlxHcEstQnaUU4QZskgQq74t+3w==} + /@typescript-eslint/typescript-estree@6.21.0(typescript@5.3.3): + resolution: {integrity: sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: typescript: '*' @@ -1659,11 +1659,12 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/types': 6.13.2 - '@typescript-eslint/visitor-keys': 6.13.2 + '@typescript-eslint/types': 6.21.0 + '@typescript-eslint/visitor-keys': 6.21.0 debug: 4.3.4(supports-color@5.5.0) globby: 11.1.0 is-glob: 4.0.3 + minimatch: 9.0.3 semver: 7.5.4 ts-api-utils: 1.0.3(typescript@5.3.3) typescript: 5.3.3 @@ -1691,8 +1692,8 @@ packages: - typescript dev: true - /@typescript-eslint/utils@6.13.2(eslint@8.56.0)(typescript@5.3.3): - resolution: {integrity: sha512-b9Ptq4eAZUym4idijCRzl61oPCwwREcfDI8xGk751Vhzig5fFZR9CyzDz4Sp/nxSLBYxUPyh4QdIDqWykFhNmQ==} + /@typescript-eslint/utils@6.21.0(eslint@8.56.0)(typescript@5.3.3): + resolution: {integrity: sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: eslint: ^7.0.0 || ^8.0.0 @@ -1700,9 +1701,9 @@ packages: '@eslint-community/eslint-utils': 4.4.0(eslint@8.56.0) '@types/json-schema': 7.0.15 '@types/semver': 7.5.6 - '@typescript-eslint/scope-manager': 6.13.2 - '@typescript-eslint/types': 6.13.2 - '@typescript-eslint/typescript-estree': 6.13.2(typescript@5.3.3) + '@typescript-eslint/scope-manager': 6.21.0 + '@typescript-eslint/types': 6.21.0 + '@typescript-eslint/typescript-estree': 6.21.0(typescript@5.3.3) eslint: 8.56.0 semver: 7.5.4 transitivePeerDependencies: @@ -1718,11 +1719,11 @@ packages: eslint-visitor-keys: 3.4.3 dev: true - /@typescript-eslint/visitor-keys@6.13.2: - resolution: {integrity: sha512-OGznFs0eAQXJsp+xSd6k/O1UbFi/K/L7WjqeRoFE7vadjAF9y0uppXhYNQNEqygjou782maGClOoZwPqF0Drlw==} + /@typescript-eslint/visitor-keys@6.21.0: + resolution: {integrity: sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==} engines: {node: ^16.0.0 || >=18.0.0} dependencies: - '@typescript-eslint/types': 6.13.2 + '@typescript-eslint/types': 6.21.0 eslint-visitor-keys: 3.4.3 dev: true @@ -1921,6 +1922,12 @@ packages: concat-map: 0.0.1 dev: true + /brace-expansion@2.0.1: + resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==} + dependencies: + balanced-match: 1.0.2 + dev: true + /braces@3.0.2: resolution: {integrity: sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==} engines: {node: '>=8'} @@ -3061,6 +3068,13 @@ packages: brace-expansion: 1.1.11 dev: true + /minimatch@9.0.3: + resolution: {integrity: sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==} + engines: {node: '>=16 || 14 >=14.17'} + dependencies: + brace-expansion: 2.0.1 + dev: true + /ms@2.1.2: resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} From 46da2f0db06fb511559c75e947846a81f13f18c7 Mon Sep 17 00:00:00 2001 From: Martin Benedikt Busch Date: Wed, 7 Feb 2024 17:09:14 +0100 Subject: [PATCH 06/14] fix formating --- packages/api/src/fetchEventCycles.ts | 2 +- packages/api/src/fetchForumQuestionStatistics.ts | 4 ++-- packages/api/src/fetchRegistration.ts | 2 +- packages/api/src/fetchRegistrationData.ts | 2 +- packages/api/src/fetchRegistrationFields.ts | 4 ++-- packages/api/src/fetchUserAttributes.ts | 2 +- packages/api/src/fetchUserVotes.ts | 4 ++-- packages/api/src/postRegistrationData.ts | 2 +- packages/berlin/src/store/index.ts | 6 +++--- packages/berlin/src/utils/formatGroups.ts | 10 ++++++---- packages/core/src/store.ts | 6 +++--- packages/core/src/utils/formatGroups.ts | 10 ++++++---- packages/core/src/utils/handleSignatureRequest.ts | 2 +- 13 files changed, 30 insertions(+), 26 deletions(-) diff --git a/packages/api/src/fetchEventCycles.ts b/packages/api/src/fetchEventCycles.ts index a4cf560c..d92d7fc5 100644 --- a/packages/api/src/fetchEventCycles.ts +++ b/packages/api/src/fetchEventCycles.ts @@ -9,7 +9,7 @@ async function fetchEventCycles(eventId: string): Promise { try { const response = await fetch( @@ -11,7 +11,7 @@ async function fetchForumQuestionStatistics( headers: { 'Content-Type': 'application/json', }, - } + }, ); if (!response.ok) { throw new Error(`HTTP Error! Status: ${response.status}`); diff --git a/packages/api/src/fetchRegistration.ts b/packages/api/src/fetchRegistration.ts index 0cec88d0..7da28037 100644 --- a/packages/api/src/fetchRegistration.ts +++ b/packages/api/src/fetchRegistration.ts @@ -9,7 +9,7 @@ async function fetchRegistration(eventId: string): Promise { try { const response = await fetch( @@ -11,7 +11,7 @@ async function fetchRegistrationFields( headers: { 'Content-Type': 'application/json', }, - } + }, ); if (!response.ok) { diff --git a/packages/api/src/fetchUserAttributes.ts b/packages/api/src/fetchUserAttributes.ts index 3de0a8b6..fe384264 100644 --- a/packages/api/src/fetchUserAttributes.ts +++ b/packages/api/src/fetchUserAttributes.ts @@ -9,7 +9,7 @@ async function fetchUserAttributes(userId: string): Promise { try { const response = await fetch( @@ -12,7 +12,7 @@ async function fetchUserVotes( headers: { 'Content-Type': 'application/json', }, - } + }, ); if (!response.ok) { throw new Error(`HTTP Error! Status: ${response.status}`); diff --git a/packages/api/src/postRegistrationData.ts b/packages/api/src/postRegistrationData.ts index f2ad9cbd..542a1ff0 100644 --- a/packages/api/src/postRegistrationData.ts +++ b/packages/api/src/postRegistrationData.ts @@ -20,7 +20,7 @@ async function postRegistrationData({ 'Content-Type': 'application/json', }, body: JSON.stringify(body), - } + }, ); if (!response.ok) { diff --git a/packages/berlin/src/store/index.ts b/packages/berlin/src/store/index.ts index 89f3bdba..81f81857 100644 --- a/packages/berlin/src/store/index.ts +++ b/packages/berlin/src/store/index.ts @@ -26,7 +26,7 @@ export const useAppStore = create()( toggleTheme: () => set((state) => ({ theme: state.theme === 'light' ? 'dark' : 'light' })), reset: () => set(() => ({ userStatus: 'INCOMPLETE' })), }), - { name: 'lexicon-store' } - ) - ) + { name: 'lexicon-store' }, + ), + ), ); diff --git a/packages/berlin/src/utils/formatGroups.ts b/packages/berlin/src/utils/formatGroups.ts index 3a038303..84740c96 100644 --- a/packages/berlin/src/utils/formatGroups.ts +++ b/packages/berlin/src/utils/formatGroups.ts @@ -6,14 +6,16 @@ import { GetGroupsResponse } from '../types/GroupType'; * @returns An array of formatted group objects with "Other" and "None" placed at the beginning. */ export const formatGroups = (groups: GetGroupsResponse[] | null | undefined) => { - return groups + return ( + groups ?.sort((a, b) => a.name.localeCompare(b.name)) - ?.reduce((acc: { name: string; id: string; }[], group) => { + ?.reduce((acc: { name: string; id: string }[], group) => { if (group.name === 'Other' || group.name === 'None') { acc.unshift({ name: group.name, id: group.id }); } else { acc.push({ name: group.name, id: group.id }); } return acc; - }, []) || []; - }; \ No newline at end of file + }, []) || [] + ); +}; diff --git a/packages/core/src/store.ts b/packages/core/src/store.ts index 15c96702..3dd8c43c 100644 --- a/packages/core/src/store.ts +++ b/packages/core/src/store.ts @@ -22,7 +22,7 @@ export const useAppStore = create()( set(() => ({ onboardingStatus: status })), reset: () => set(() => ({ userStatus: 'INCOMPLETE' })), }), - { name: 'lexicon-store' } - ) - ) + { name: 'lexicon-store' }, + ), + ), ); diff --git a/packages/core/src/utils/formatGroups.ts b/packages/core/src/utils/formatGroups.ts index 3a038303..84740c96 100644 --- a/packages/core/src/utils/formatGroups.ts +++ b/packages/core/src/utils/formatGroups.ts @@ -6,14 +6,16 @@ import { GetGroupsResponse } from '../types/GroupType'; * @returns An array of formatted group objects with "Other" and "None" placed at the beginning. */ export const formatGroups = (groups: GetGroupsResponse[] | null | undefined) => { - return groups + return ( + groups ?.sort((a, b) => a.name.localeCompare(b.name)) - ?.reduce((acc: { name: string; id: string; }[], group) => { + ?.reduce((acc: { name: string; id: string }[], group) => { if (group.name === 'Other' || group.name === 'None') { acc.unshift({ name: group.name, id: group.id }); } else { acc.push({ name: group.name, id: group.id }); } return acc; - }, []) || []; - }; \ No newline at end of file + }, []) || [] + ); +}; diff --git a/packages/core/src/utils/handleSignatureRequest.ts b/packages/core/src/utils/handleSignatureRequest.ts index f58ae2d8..41ce2f19 100644 --- a/packages/core/src/utils/handleSignatureRequest.ts +++ b/packages/core/src/utils/handleSignatureRequest.ts @@ -30,7 +30,7 @@ const handleSignatureRequest = (nonce: string | null) => { args, { genericProveScreen: true, - } + }, ); openZupassPopup(POPUP_URL, constructProofUrl); From 3faaeabb41e93860008a2dee81e220d52c103b00 Mon Sep 17 00:00:00 2001 From: Martin Benedikt Busch Date: Wed, 7 Feb 2024 17:14:59 +0100 Subject: [PATCH 07/14] allow any type --- .eslintrc.cjs | 1 + 1 file changed, 1 insertion(+) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index a4622ee3..52159f9f 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -13,6 +13,7 @@ module.exports = { 'react-refresh/only-export-components': ['warn', { allowConstantExport: true }], '@typescript-eslint/ban-ts-comment': 'warn', '@typescript-eslint/no-var-requires': 'off', + '@typescript-eslint/no-explicit-any': 'off', '@typescript-eslint/no-unused-vars': [ 'warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_ignored', ignoreRestSiblings: true }, From 8181043866a8b57ebca85f64b65e271dfa423413 Mon Sep 17 00:00:00 2001 From: Martin Benedikt Busch Date: Wed, 7 Feb 2024 17:32:32 +0100 Subject: [PATCH 08/14] fix linting --- .eslintrc.cjs | 1 + 1 file changed, 1 insertion(+) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 52159f9f..f91cf484 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -14,6 +14,7 @@ module.exports = { '@typescript-eslint/ban-ts-comment': 'warn', '@typescript-eslint/no-var-requires': 'off', '@typescript-eslint/no-explicit-any': 'off', + '@tanstack/query/exhaustive-deps': 'off', '@typescript-eslint/no-unused-vars': [ 'warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_ignored', ignoreRestSiblings: true }, From 0fb778ccaf8bc47e5f0cc6723efc47d55bdc1565 Mon Sep 17 00:00:00 2001 From: Martin Benedikt Busch Date: Wed, 7 Feb 2024 17:46:32 +0100 Subject: [PATCH 09/14] remove core and berlin lint --- package.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/package.json b/package.json index da9754f4..d62f8c3b 100644 --- a/package.json +++ b/package.json @@ -6,11 +6,9 @@ "scripts": { "core:dev": "pnpm -r --filter core dev", "core:build": "pnpm -r --filter core build", - "core:lint": "pnpm -r --filter core lint", "core:preview": "pnpm -r --filter core preview", "berlin:dev": "pnpm -r --filter berlin dev", "berlin:build": "pnpm -r --filter berlin build", - "berlin:lint": "pnpm -r --filter berlin lint", "berlin:preview": "pnpm -r --filter berlin preview", "format": "prettier --check \"packages/**/*.{ts,md}\"", "format:fix": "prettier --write \"packages/**/*.{ts,md}\"", From c6d7f8e07a7747fb6f6ffc745e158bfe3d87768d Mon Sep 17 00:00:00 2001 From: Martin Benedikt Busch Date: Thu, 8 Feb 2024 09:11:21 +0100 Subject: [PATCH 10/14] add back env property --- .eslintrc.cjs | 1 + 1 file changed, 1 insertion(+) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index f91cf484..d90b61d2 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -9,6 +9,7 @@ module.exports = { parser: '@typescript-eslint/parser', plugins: ['react-refresh', '@typescript-eslint'], root: true, + env: { browser: true, es2020: true }, rules: { 'react-refresh/only-export-components': ['warn', { allowConstantExport: true }], '@typescript-eslint/ban-ts-comment': 'warn', From dbbf6e3d81075fef8c9db5dbd485eb97278feae3 Mon Sep 17 00:00:00 2001 From: Martin Benedikt Busch Date: Thu, 8 Feb 2024 09:18:24 +0100 Subject: [PATCH 11/14] move ignored files to .eslint.cjs --- .eslintignore | 3 --- .eslintrc.cjs | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) delete mode 100644 .eslintignore diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 9ee7f74e..00000000 --- a/.eslintignore +++ /dev/null @@ -1,3 +0,0 @@ -# exclude .js files from linting -/dist/ -.eslintrc.cjs \ No newline at end of file diff --git a/.eslintrc.cjs b/.eslintrc.cjs index d90b61d2..e473cdf4 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -10,6 +10,7 @@ module.exports = { plugins: ['react-refresh', '@typescript-eslint'], root: true, env: { browser: true, es2020: true }, + ignorePatterns: ['dist', '.eslintrc.cjs'], rules: { 'react-refresh/only-export-components': ['warn', { allowConstantExport: true }], '@typescript-eslint/ban-ts-comment': 'warn', From 18bbda32fbee4f8f31a8f68791b10db79d9edae1 Mon Sep 17 00:00:00 2001 From: Martin Benedikt Busch Date: Thu, 8 Feb 2024 09:24:07 +0100 Subject: [PATCH 12/14] warn if there are any types --- .eslintrc.cjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index e473cdf4..cbd5ea73 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -14,8 +14,8 @@ module.exports = { rules: { 'react-refresh/only-export-components': ['warn', { allowConstantExport: true }], '@typescript-eslint/ban-ts-comment': 'warn', - '@typescript-eslint/no-var-requires': 'off', - '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/no-var-requires': 'warn', + '@typescript-eslint/no-explicit-any': 'warn', '@tanstack/query/exhaustive-deps': 'off', '@typescript-eslint/no-unused-vars': [ 'warn', From 188efd70bbd4b3365eca2bcdf52a6dd66b269d31 Mon Sep 17 00:00:00 2001 From: Martin Benedikt Busch Date: Thu, 8 Feb 2024 09:25:59 +0100 Subject: [PATCH 13/14] turn on linting rules --- .eslintrc.cjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index cbd5ea73..5fb015ed 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -16,9 +16,9 @@ module.exports = { '@typescript-eslint/ban-ts-comment': 'warn', '@typescript-eslint/no-var-requires': 'warn', '@typescript-eslint/no-explicit-any': 'warn', - '@tanstack/query/exhaustive-deps': 'off', + '@tanstack/query/exhaustive-deps': 'warn', '@typescript-eslint/no-unused-vars': [ - 'warn', + 'error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_ignored', ignoreRestSiblings: true }, ], }, From 18b077c54c79602ac3311ebb924880874ed90ea8 Mon Sep 17 00:00:00 2001 From: Martin Benedikt Busch Date: Thu, 8 Feb 2024 09:35:15 +0100 Subject: [PATCH 14/14] add rule explanation --- .eslintrc.cjs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 5fb015ed..157cdc3c 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -12,14 +12,31 @@ module.exports = { env: { browser: true, es2020: true }, ignorePatterns: ['dist', '.eslintrc.cjs'], rules: { + // 1. 'react-refresh/only-export-components': Ensure React components are exported properly + // Warn because it's important but not necessarily an error 'react-refresh/only-export-components': ['warn', { allowConstantExport: true }], + + // 2. '@typescript-eslint/ban-ts-comment': Avoid using @ts-ignore comments + // Warn to discourage usage, but doesn't necessarily break the build '@typescript-eslint/ban-ts-comment': 'warn', + + // 3. '@typescript-eslint/no-var-requires': Discourage using require() in favor of ES6 imports + // Warn to discourage usage, but doesn't necessarily break the build '@typescript-eslint/no-var-requires': 'warn', + + // 4. '@typescript-eslint/no-explicit-any': Avoid using explicit 'any' types + // Warn to encourage type safety, could be upgraded to 'error' for stricter enforcement '@typescript-eslint/no-explicit-any': 'warn', + + // 5. '@tanstack/query/exhaustive-deps': Ensure exhaustive dependency arrays in React hooks + // Warn to highlight potential issues, but doesn't necessarily break the build '@tanstack/query/exhaustive-deps': 'warn', + + // 6. '@typescript-eslint/no-unused-vars': Avoid unused variables, enforcing cleaner code + // Error to ensure unused variables are caught during linting '@typescript-eslint/no-unused-vars': [ 'error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_ignored', ignoreRestSiblings: true }, ], }, -}; +}; \ No newline at end of file