From 9ed5b986ded9b02cd0191e6fc1038bcdce90e3af Mon Sep 17 00:00:00 2001 From: aurelienrichard Date: Sun, 19 May 2024 13:59:59 +0200 Subject: [PATCH] refactor & update eslint config --- .../src/lib/components/NewMessageForm.svelte | 16 ++-- packages/eslint-config/index.js | 3 +- packages/eslint-config/package.json | 2 - pnpm-lock.yaml | 93 +++---------------- 4 files changed, 22 insertions(+), 92 deletions(-) diff --git a/apps/privelte/src/lib/components/NewMessageForm.svelte b/apps/privelte/src/lib/components/NewMessageForm.svelte index 059669b..f49e99b 100644 --- a/apps/privelte/src/lib/components/NewMessageForm.svelte +++ b/apps/privelte/src/lib/components/NewMessageForm.svelte @@ -11,13 +11,6 @@ const dispatch = createEventDispatcher() - const setHeight = () => { - if (textarea) { - textarea.style.height = '40px' - textarea.style.height = `${textarea.scrollHeight}px` - } - } - onMount(() => { textarea.focus() }) @@ -26,7 +19,14 @@ setHeight() }) - const handleMessage = () => { + function setHeight() { + if (textarea) { + textarea.style.height = '40px' + textarea.style.height = `${textarea.scrollHeight}px` + } + } + + function handleMessage() { const id = nanoid() dispatch('message', { message, id }) diff --git a/packages/eslint-config/index.js b/packages/eslint-config/index.js index 008e218..b09426d 100644 --- a/packages/eslint-config/index.js +++ b/packages/eslint-config/index.js @@ -1,7 +1,5 @@ module.exports = { extends: [ - 'airbnb-base', - 'airbnb-typescript/base', 'eslint:recommended', 'plugin:@typescript-eslint/recommended-type-checked', 'plugin:@typescript-eslint/stylistic-type-checked', @@ -38,6 +36,7 @@ module.exports = { rules: { // https://github.com/iamturns/eslint-config-airbnb-typescript#why-is-importno-unresolved-disabled 'import/no-unresolved': 'off', + 'import/no-named-as-default': 'off', // unreliable for monorepos 'import/no-extraneous-dependencies': 'off', // yells on import of env variables diff --git a/packages/eslint-config/package.json b/packages/eslint-config/package.json index c10580b..21eee12 100644 --- a/packages/eslint-config/package.json +++ b/packages/eslint-config/package.json @@ -6,8 +6,6 @@ "dependencies": { "@typescript-eslint/eslint-plugin": "^6.21.0", "@typescript-eslint/parser": "^6.21.0", - "eslint-config-airbnb-base": "^15.0.0", - "eslint-config-airbnb-typescript": "^17.1.0", "eslint-config-prettier": "^9.1.0", "eslint-config-turbo": "^1.13.3", "eslint-plugin-import": "npm:eslint-plugin-i@2.29.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7a197cb..6c3c8c5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -49,7 +49,7 @@ importers: version: 1.13.3 vitest: specifier: ^1.6.0 - version: 1.6.0(@types/node@20.12.8)(@vitest/ui@1.6.0)(happy-dom@13.10.1) + version: 1.6.0(@types/node@20.12.8)(@vitest/ui@1.6.0(vitest@1.6.0))(happy-dom@13.10.1) wrangler: specifier: ^3.53.1 version: 3.53.1(@cloudflare/workers-types@4.20240423.0) @@ -80,7 +80,7 @@ importers: version: 4.2.15 svelte-check: specifier: ^3.5.2 - version: 3.6.9(postcss-load-config@4.0.2(postcss@8.4.38)(ts-node@10.9.2(@types/node@20.12.8)(typescript@5.4.5)))(postcss@8.4.38)(svelte@4.2.15) + version: 3.6.9(postcss-load-config@4.0.2(postcss@8.4.38))(postcss@8.4.38)(svelte@4.2.15) tslib: specifier: ^2.6.2 version: 2.6.2 @@ -138,7 +138,7 @@ importers: version: 0.5.7(tailwindcss@3.4.3(ts-node@10.9.2(@types/node@20.12.8)(typescript@5.4.5))) '@testing-library/jest-dom': specifier: ^6.4.5 - version: 6.4.5(vitest@1.6.0(@types/node@20.12.8)(@vitest/ui@1.6.0)(happy-dom@13.10.1)) + version: 6.4.5(vitest@1.6.0(@types/node@20.12.8)(@vitest/ui@1.6.0(vitest@1.6.0))(happy-dom@13.10.1)) '@testing-library/svelte': specifier: ^4.2.3 version: 4.2.3(svelte@4.2.15) @@ -205,7 +205,7 @@ importers: version: 4.2.15 svelte-check: specifier: ^3.5.2 - version: 3.6.9(postcss-load-config@4.0.2(postcss@8.4.38)(ts-node@10.9.2(@types/node@20.12.8)(typescript@5.4.5)))(postcss@8.4.38)(svelte@4.2.15) + version: 3.6.9(postcss-load-config@4.0.2(postcss@8.4.38))(postcss@8.4.38)(svelte@4.2.15) tslib: specifier: ^2.6.2 version: 2.6.2 @@ -251,7 +251,7 @@ importers: version: 3.1.0(svelte@4.2.15)(vite@5.2.11(@types/node@20.12.8)) '@testing-library/jest-dom': specifier: ^6.4.2 - version: 6.4.2(vitest@1.6.0(@types/node@20.12.8)(@vitest/ui@1.6.0)(happy-dom@13.10.1)) + version: 6.4.2(vitest@1.6.0(@types/node@20.12.8)(@vitest/ui@1.6.0(vitest@1.6.0))(happy-dom@13.10.1)) '@testing-library/svelte': specifier: ^4.2.3 version: 4.2.3(svelte@4.2.15) @@ -294,12 +294,6 @@ importers: '@typescript-eslint/parser': specifier: ^6.21.0 version: 6.21.0(eslint@8.57.0)(typescript@5.4.5) - eslint-config-airbnb-base: - specifier: ^15.0.0 - version: 15.0.0(eslint-plugin-i@2.29.1(@typescript-eslint/parser@6.21.0(eslint@8.57.0)(typescript@5.4.5))(eslint@8.57.0))(eslint@8.57.0) - eslint-config-airbnb-typescript: - specifier: ^17.1.0 - version: 17.1.0(@typescript-eslint/eslint-plugin@6.21.0(@typescript-eslint/parser@6.21.0(eslint@8.57.0)(typescript@5.4.5))(eslint@8.57.0)(typescript@5.4.5))(@typescript-eslint/parser@6.21.0(eslint@8.57.0)(typescript@5.4.5))(eslint-plugin-i@2.29.1(@typescript-eslint/parser@6.21.0(eslint@8.57.0)(typescript@5.4.5))(eslint@8.57.0))(eslint@8.57.0) eslint-config-prettier: specifier: ^9.1.0 version: 9.1.0(eslint@8.57.0) @@ -1635,9 +1629,6 @@ packages: confbox@0.1.7: resolution: {integrity: sha512-uJcB/FKZtBMCJpK8MQji6bJHgu1tixKPxRLeGkNzBoOZzpnZUJm0jm2/sBDWcuBx1dYgxV4JU+g5hmNxCyAmdA==} - confusing-browser-globals@1.0.11: - resolution: {integrity: sha512-JsPKdmh8ZkmnHxDk55FZ1TqVLvEQTvoByJZRN9jzI0UjxK/QgAmsphz7PGtqgPieQZ/CQcHWXCR7ATDNhGe+YA==} - constant-case@2.0.0: resolution: {integrity: sha512-eS0N9WwmjTqrOmR3o83F5vW8Z+9R1HnVz3xmzT2PMFug9ly+Au/fxRWlEBSb6LcZwspSsEn9Xs1uw9YgzAg1EQ==} @@ -1816,10 +1807,6 @@ packages: es-get-iterator@1.1.3: resolution: {integrity: sha512-sPZmqHBe6JIiTfN5q2pEi//TwxmAFHwj/XEuYjTuse78i8KxaqMTTzxPoFKuzRpDpTJ+0NAbpfenkmH2rePtuw==} - es-object-atoms@1.0.0: - resolution: {integrity: sha512-MZ4iQ6JwHOBQjahnjwaC1ZtIBH+2ohjamzAO3oaHcXYup7qxjF2fixyH+Q71voWHeOkI2q/TnJao/KfXYIZWbw==} - engines: {node: '>= 0.4'} - es6-promise@3.3.1: resolution: {integrity: sha512-SOp9Phqvqn7jtEUxPWdWfWoLmyt2VaJ6MpvP9Comy1MceMXqE6bxvaTu4iaxpYYPzhny28Lc+M87/c2cPK6lDg==} @@ -1861,21 +1848,6 @@ packages: peerDependencies: eslint: '>=6.0.0' - eslint-config-airbnb-base@15.0.0: - resolution: {integrity: sha512-xaX3z4ZZIcFLvh2oUNvcX5oEofXda7giYmuplVxoOg5A7EXJMrUyqRgR+mhDhPK8LZ4PttFOBvCYDbX3sUoUig==} - engines: {node: ^10.12.0 || >=12.0.0} - peerDependencies: - eslint: ^7.32.0 || ^8.2.0 - eslint-plugin-import: ^2.25.2 - - eslint-config-airbnb-typescript@17.1.0: - resolution: {integrity: sha512-GPxI5URre6dDpJ0CtcthSZVBAfI+Uw7un5OYNVxP2EYi3H81Jw701yFP7AU+/vCE7xBtFmjge7kfhhk4+RAiig==} - peerDependencies: - '@typescript-eslint/eslint-plugin': ^5.13.0 || ^6.0.0 - '@typescript-eslint/parser': ^5.0.0 || ^6.0.0 - eslint: ^7.32.0 || ^8.2.0 - eslint-plugin-import: ^2.25.3 - eslint-config-prettier@9.1.0: resolution: {integrity: sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==} hasBin: true @@ -2772,10 +2744,6 @@ packages: resolution: {integrity: sha512-byy+U7gp+FVwmyzKPYhW2h5l3crpmGsxl7X2s8y43IgxvG4g3QZ6CffDtsNQy1WsmZpQbO+ybo0AlW7TY6DcBQ==} engines: {node: '>= 0.4'} - object.entries@1.1.8: - resolution: {integrity: sha512-cmopxi8VwRIAw/fkijJohSfpef5PdN0pMQJN6VC/ZKvn0LIknWD8KtgY6KlQdEc4tIjcQ3HxSMmnvtzIscdaYQ==} - engines: {node: '>= 0.4'} - once@1.4.0: resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} @@ -3208,10 +3176,6 @@ packages: resolution: {integrity: sha512-th5B4L2U+eGLq1TVh7zNRGBapioSORUeymIydxgFpwww9d2qyKvtuPU2jJuHvYAwwqi2Y596QBL3eEqcPEYL8Q==} engines: {node: '>=10'} - semver@6.3.1: - resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==} - hasBin: true - semver@7.6.0: resolution: {integrity: sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==} engines: {node: '>=10'} @@ -4586,7 +4550,7 @@ snapshots: lz-string: 1.5.0 pretty-format: 27.5.1 - '@testing-library/jest-dom@6.4.2(vitest@1.6.0(@types/node@20.12.8)(@vitest/ui@1.6.0)(happy-dom@13.10.1))': + '@testing-library/jest-dom@6.4.2(vitest@1.6.0(@types/node@20.12.8)(@vitest/ui@1.6.0(vitest@1.6.0))(happy-dom@13.10.1))': dependencies: '@adobe/css-tools': 4.3.3 '@babel/runtime': 7.24.4 @@ -4597,9 +4561,9 @@ snapshots: lodash: 4.17.21 redent: 3.0.0 optionalDependencies: - vitest: 1.6.0(@types/node@20.12.8)(@vitest/ui@1.6.0)(happy-dom@13.10.1) + vitest: 1.6.0(@types/node@20.12.8)(@vitest/ui@1.6.0(vitest@1.6.0))(happy-dom@13.10.1) - '@testing-library/jest-dom@6.4.5(vitest@1.6.0(@types/node@20.12.8)(@vitest/ui@1.6.0)(happy-dom@13.10.1))': + '@testing-library/jest-dom@6.4.5(vitest@1.6.0(@types/node@20.12.8)(@vitest/ui@1.6.0(vitest@1.6.0))(happy-dom@13.10.1))': dependencies: '@adobe/css-tools': 4.3.3 '@babel/runtime': 7.24.4 @@ -4610,7 +4574,7 @@ snapshots: lodash: 4.17.21 redent: 3.0.0 optionalDependencies: - vitest: 1.6.0(@types/node@20.12.8)(@vitest/ui@1.6.0)(happy-dom@13.10.1) + vitest: 1.6.0(@types/node@20.12.8)(@vitest/ui@1.6.0(vitest@1.6.0))(happy-dom@13.10.1) '@testing-library/svelte@4.2.3(svelte@4.2.15)': dependencies: @@ -4815,7 +4779,7 @@ snapshots: std-env: 3.7.0 strip-literal: 2.1.0 test-exclude: 6.0.0 - vitest: 1.6.0(@types/node@20.12.8)(@vitest/ui@1.6.0)(happy-dom@13.10.1) + vitest: 1.6.0(@types/node@20.12.8)(@vitest/ui@1.6.0(vitest@1.6.0))(happy-dom@13.10.1) transitivePeerDependencies: - supports-color @@ -4850,7 +4814,7 @@ snapshots: pathe: 1.1.2 picocolors: 1.0.0 sirv: 2.0.4 - vitest: 1.6.0(@types/node@20.12.8)(@vitest/ui@1.6.0)(happy-dom@13.10.1) + vitest: 1.6.0(@types/node@20.12.8)(@vitest/ui@1.6.0(vitest@1.6.0))(happy-dom@13.10.1) '@vitest/utils@1.6.0': dependencies: @@ -5171,8 +5135,6 @@ snapshots: confbox@0.1.7: {} - confusing-browser-globals@1.0.11: {} - constant-case@2.0.0: dependencies: snake-case: 2.1.0 @@ -5343,10 +5305,6 @@ snapshots: isarray: 2.0.5 stop-iteration-iterator: 1.0.0 - es-object-atoms@1.0.0: - dependencies: - es-errors: 1.3.0 - es6-promise@3.3.1: {} esbuild@0.17.19: @@ -5444,23 +5402,6 @@ snapshots: eslint: 8.57.0 semver: 7.6.0 - eslint-config-airbnb-base@15.0.0(eslint-plugin-i@2.29.1(@typescript-eslint/parser@6.21.0(eslint@8.57.0)(typescript@5.4.5))(eslint@8.57.0))(eslint@8.57.0): - dependencies: - confusing-browser-globals: 1.0.11 - eslint: 8.57.0 - eslint-plugin-import: eslint-plugin-i@2.29.1(@typescript-eslint/parser@6.21.0(eslint@8.57.0)(typescript@5.4.5))(eslint@8.57.0) - object.assign: 4.1.5 - object.entries: 1.1.8 - semver: 6.3.1 - - eslint-config-airbnb-typescript@17.1.0(@typescript-eslint/eslint-plugin@6.21.0(@typescript-eslint/parser@6.21.0(eslint@8.57.0)(typescript@5.4.5))(eslint@8.57.0)(typescript@5.4.5))(@typescript-eslint/parser@6.21.0(eslint@8.57.0)(typescript@5.4.5))(eslint-plugin-i@2.29.1(@typescript-eslint/parser@6.21.0(eslint@8.57.0)(typescript@5.4.5))(eslint@8.57.0))(eslint@8.57.0): - dependencies: - '@typescript-eslint/eslint-plugin': 6.21.0(@typescript-eslint/parser@6.21.0(eslint@8.57.0)(typescript@5.4.5))(eslint@8.57.0)(typescript@5.4.5) - '@typescript-eslint/parser': 6.21.0(eslint@8.57.0)(typescript@5.4.5) - eslint: 8.57.0 - eslint-config-airbnb-base: 15.0.0(eslint-plugin-i@2.29.1(@typescript-eslint/parser@6.21.0(eslint@8.57.0)(typescript@5.4.5))(eslint@8.57.0))(eslint@8.57.0) - eslint-plugin-import: eslint-plugin-i@2.29.1(@typescript-eslint/parser@6.21.0(eslint@8.57.0)(typescript@5.4.5))(eslint@8.57.0) - eslint-config-prettier@9.1.0(eslint@8.57.0): dependencies: eslint: 8.57.0 @@ -6429,12 +6370,6 @@ snapshots: has-symbols: 1.0.3 object-keys: 1.1.1 - object.entries@1.1.8: - dependencies: - call-bind: 1.0.7 - define-properties: 1.2.1 - es-object-atoms: 1.0.0 - once@1.4.0: dependencies: wrappy: 1.0.2 @@ -6852,8 +6787,6 @@ snapshots: '@types/node-forge': 1.3.11 node-forge: 1.3.1 - semver@6.3.1: {} - semver@7.6.0: dependencies: lru-cache: 6.0.0 @@ -7044,7 +6977,7 @@ snapshots: supports-preserve-symlinks-flag@1.0.0: {} - svelte-check@3.6.9(postcss-load-config@4.0.2(postcss@8.4.38)(ts-node@10.9.2(@types/node@20.12.8)(typescript@5.4.5)))(postcss@8.4.38)(svelte@4.2.15): + svelte-check@3.6.9(postcss-load-config@4.0.2(postcss@8.4.38))(postcss@8.4.38)(svelte@4.2.15): dependencies: '@jridgewell/trace-mapping': 0.3.25 chokidar: 3.6.0 @@ -7414,7 +7347,7 @@ snapshots: optionalDependencies: vite: 5.2.11(@types/node@20.12.8) - vitest@1.6.0(@types/node@20.12.8)(@vitest/ui@1.6.0)(happy-dom@13.10.1): + vitest@1.6.0(@types/node@20.12.8)(@vitest/ui@1.6.0(vitest@1.6.0))(happy-dom@13.10.1): dependencies: '@vitest/expect': 1.6.0 '@vitest/runner': 1.6.0