From 5dc4e01ede89e1a8995e76930562cfbb0288df47 Mon Sep 17 00:00:00 2001 From: Samuel Date: Sat, 14 Dec 2024 12:16:17 +0100 Subject: [PATCH] chore: migrate eslint and prettier to biome and fix all linting errors --- .vscode/settings.json | 13 +- biome.json | 196 +++++++++++++++++ eslint.config.js | 76 ------- package.json | 8 +- pnpm-lock.yaml | 303 ++++++++------------------ prettier.config.js | 9 - src/App.tsx | 20 +- src/app.css | 4 +- src/components/ui/charts.tsx | 46 ++-- src/components/ui/checkbox.tsx | 5 +- src/components/ui/label.tsx | 2 +- src/components/ui/table.tsx | 40 +--- src/components/ui/text-field.tsx | 28 +-- src/db.ts | 8 +- src/lib/getNameFromRecipient.ts | 17 ++ src/pages/dm/dm-id.tsx | 10 +- src/pages/group/group-id.tsx | 2 + src/pages/home.tsx | 6 +- src/pages/overview/index.tsx | 24 +- src/pages/overview/overview-table.tsx | 39 +--- tsconfig.json | 20 +- ui.config.json | 2 +- 22 files changed, 397 insertions(+), 481 deletions(-) create mode 100644 biome.json delete mode 100644 eslint.config.js delete mode 100644 prettier.config.js create mode 100644 src/lib/getNameFromRecipient.ts diff --git a/.vscode/settings.json b/.vscode/settings.json index a1cd576..153cc7a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,12 @@ { - "editor.codeActionsOnSave": { - "source.fixAll.eslint": "explicit" - } + "editor.codeActionsOnSave": { + "quickfix.biome": "explicit" + }, + "[typescript]": { + "editor.defaultFormatter": "biomejs.biome" + }, + "[typescriptreact]": { + "editor.defaultFormatter": "biomejs.biome" + }, + "typescript.inlayHints.parameterNames.enabled": "all" } \ No newline at end of file diff --git a/biome.json b/biome.json new file mode 100644 index 0000000..f1def8a --- /dev/null +++ b/biome.json @@ -0,0 +1,196 @@ +{ + "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json", + "vcs": { "enabled": true, "clientKind": "git", "useIgnoreFile": true }, + "formatter": { + "enabled": true, + "useEditorconfig": true, + "formatWithErrors": false, + "indentStyle": "space", + "indentWidth": 2, + "lineEnding": "lf", + "lineWidth": 120, + "attributePosition": "multiline", + "bracketSpacing": true + }, + "linter": { + "enabled": true, + "rules": { + "recommended": false, + "complexity": { + "noExtraBooleanCast": "error", + "noMultipleSpacesInRegularExpressionLiterals": "error", + "noStaticOnlyClass": "error", + "noUselessCatch": "error", + "noUselessConstructor": "error", + "noUselessTypeConstraint": "error", + "noWith": "error", + "useLiteralKeys": "error", + "useOptionalChain": "error" + }, + "correctness": { + "noConstAssign": "error", + "noConstantCondition": "error", + "noEmptyCharacterClassInRegex": "error", + "noEmptyPattern": "error", + "noGlobalObjectCalls": "error", + "noInvalidBuiltinInstantiation": "error", + "noInvalidConstructorSuper": "error", + "noNonoctalDecimalEscape": "error", + "noPrecisionLoss": "error", + "noSelfAssign": "error", + "noSetterReturn": "error", + "noSwitchDeclarations": "error", + "noUndeclaredVariables": "error", + "noUnreachable": "error", + "noUnreachableSuper": "error", + "noUnsafeFinally": "error", + "noUnsafeOptionalChaining": "error", + "noUnusedLabels": "error", + "noUnusedPrivateClassMembers": "error", + "noUnusedVariables": "error", + "useArrayLiterals": "off", + "useIsNan": "error", + "useValidForDirection": "error", + "useYield": "error" + }, + "style": { + "noInferrableTypes": "error", + "noNamespace": "error", + "noNonNullAssertion": "error", + "useAsConstAssertion": "error", + "useBlockStatements": "off", + "useConsistentArrayType": "error", + "useForOf": "error", + "useLiteralEnumMembers": "error", + "useShorthandFunctionType": "error" + }, + "suspicious": { + "noAsyncPromiseExecutor": "error", + "noCatchAssign": "error", + "noClassAssign": "error", + "noCompareNegZero": "error", + "noConfusingVoidType": "error", + "noControlCharactersInRegex": "error", + "noDebugger": "error", + "noDuplicateCase": "error", + "noDuplicateClassMembers": "error", + "noDuplicateObjectKeys": "error", + "noDuplicateParameters": "error", + "noEmptyBlockStatements": "error", + "noExplicitAny": "error", + "noExtraNonNullAssertion": "error", + "noFallthroughSwitchClause": "error", + "noFunctionAssign": "error", + "noGlobalAssign": "error", + "noImportAssign": "error", + "noMisleadingCharacterClass": "error", + "noMisleadingInstantiator": "error", + "noPrototypeBuiltins": "error", + "noRedeclare": "error", + "noShadowRestrictedNames": "error", + "noSparseArray": "error", + "noUnsafeDeclarationMerging": "error", + "noUnsafeNegation": "error", + "useAwait": "error", + "useGetterReturn": "error", + "useNamespaceKeyword": "error", + "useValidTypeof": "error" + }, + "nursery": { + "useSortedClasses": { + "level": "error", + "fix": "safe", + "options": { + "attributes": ["className"], + "functions": ["cn"] + } + } + } + }, + "ignore": ["dist/**/*.ts", "dist/**", "**/*.mjs", "eslint.config.js", "**/*.js"] + }, + "javascript": { + "formatter": { + "jsxQuoteStyle": "double", + "quoteProperties": "asNeeded", + "trailingCommas": "all", + "semicolons": "always", + "arrowParentheses": "always", + "bracketSameLine": false, + "quoteStyle": "double", + "attributePosition": "auto", + "bracketSpacing": true + }, + "globals": [] + }, + "overrides": [ + { + "include": ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"], + "linter": { + "rules": { + "correctness": { + "noConstAssign": "off", + "noGlobalObjectCalls": "off", + "noInvalidBuiltinInstantiation": "off", + "noInvalidConstructorSuper": "off", + "noNewSymbol": "off", + "noSetterReturn": "off", + "noUndeclaredVariables": "off", + "noUnreachable": "off", + "noUnreachableSuper": "off" + }, + "style": { + "noArguments": "error", + "noVar": "error", + "useConst": "error" + }, + "suspicious": { + "noClassAssign": "off", + "noDuplicateClassMembers": "off", + "noDuplicateObjectKeys": "off", + "noDuplicateParameters": "off", + "noFunctionAssign": "off", + "noImportAssign": "off", + "noRedeclare": "off", + "noUnsafeNegation": "off", + "useGetterReturn": "off" + } + } + } + }, + { + "include": ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"], + "linter": { + "rules": { + "correctness": { + "noConstAssign": "off", + "noGlobalObjectCalls": "off", + "noInvalidBuiltinInstantiation": "off", + "noInvalidConstructorSuper": "off", + "noNewSymbol": "off", + "noSetterReturn": "off", + "noUndeclaredVariables": "off", + "noUnreachable": "off", + "noUnreachableSuper": "off" + }, + "style": { + "noArguments": "error", + "noVar": "error", + "useConst": "error" + }, + "suspicious": { + "noClassAssign": "off", + "noDuplicateClassMembers": "off", + "noDuplicateObjectKeys": "off", + "noDuplicateParameters": "off", + "noFunctionAssign": "off", + "noImportAssign": "off", + "noRedeclare": "off", + "noUnsafeNegation": "off", + "useGetterReturn": "off" + } + } + } + } + ] +} diff --git a/eslint.config.js b/eslint.config.js deleted file mode 100644 index 69f5da6..0000000 --- a/eslint.config.js +++ /dev/null @@ -1,76 +0,0 @@ -// @ts-check - -import eslint from "@eslint/js"; -import tsparser from "@typescript-eslint/parser"; -import eslintConfigPrettier from "eslint-config-prettier"; -import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended"; -import simpleImportSort from "eslint-plugin-simple-import-sort"; -import solid from "eslint-plugin-solid/configs/typescript"; -import tseslint from "typescript-eslint"; - -export default tseslint.config( - { - ignores: ["dist/**/*.ts", "dist/**", "**/*.mjs", "eslint.config.js", "**/*.js"], - }, - [ - eslint.configs.recommended, - tseslint.configs.strictTypeChecked, - tseslint.configs.stylisticTypeChecked, - eslintPluginPrettierRecommended, - eslintConfigPrettier, - { - ...solid, - languageOptions: { - parser: tsparser, - // Specifies the ESLint parser - parserOptions: { - ecmaVersion: 2024, - // Allows for the parsing of modern ECMAScript features - sourceType: "module", - // Allows for the use of imports - ecmaFeatures: { - jsx: true, // Allows for the parsing of JSX - }, - project: "./tsconfig.json", - projectService: true, - tsconfigRootDir: import.meta.dirname, - }, - }, - - plugins: { - "simple-import-sort": simpleImportSort, - }, - rules: { - // Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs - // e.g. "@typescript-eslint/explicit-function-return-type": "off", - "simple-import-sort/imports": [ - "error", - { - groups: [ - // solidjs - ["^solid-(js|start)", "^@solidjs/"], - ["^@?\\w"], - // components imports - ["^~/components/?"], - // other /src imports - ["^~/"], - // Parent imports. Put `..` last. - ["^\\.\\.(?!/?$)", "^\\.\\./?$"], - // Other relative imports. Put same-folder imports and `.` last. - ["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"], - // types imports - ["^~/types$"], - // Side effect imports. - ["^\\u0000"], - // Style imports. - ["^.+\\.?(s?css)$"], - ], - }, - ], - "simple-import-sort/exports": "error", - // "@typescript-eslint/consistent-type-imports": "error", - // "@typescript-eslint/consistent-type-exports": "error", - }, - }, - ], -); diff --git a/package.json b/package.json index a7a8ef5..8232b8f 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ }, "license": "MIT", "devDependencies": { + "@biomejs/biome": "1.9.4", "@eslint/js": "^9.16.0", "@types/node": "^22.10.1", "@types/sql.js": "^1.4.9", @@ -20,15 +21,8 @@ "@typescript-eslint/parser": "^8.17.0", "autoprefixer": "^10.4.20", "better-sqlite3": "^11.7.0", - "eslint": "^9.16.0", - "eslint-config-prettier": "^9.1.0", - "eslint-plugin-prettier": "^5.2.1", - "eslint-plugin-simple-import-sort": "^12.1.1", - "eslint-plugin-solid": "^0.14.4", "kysely-codegen": "^0.17.0", "postcss": "^8.4.49", - "prettier": "^3.4.2", - "prettier-plugin-tailwindcss": "^0.6.9", "tailwindcss": "^3.4.16", "typescript": "^5.7.2", "typescript-eslint": "^8.17.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f346487..50e125e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -66,6 +66,9 @@ importers: specifier: ^1.0.7 version: 1.0.7(tailwindcss@3.4.16) devDependencies: + '@biomejs/biome': + specifier: 1.9.4 + version: 1.9.4 '@eslint/js': specifier: ^9.16.0 version: 9.16.0 @@ -87,33 +90,12 @@ importers: better-sqlite3: specifier: ^11.7.0 version: 11.7.0 - eslint: - specifier: ^9.16.0 - version: 9.16.0(jiti@1.21.6) - eslint-config-prettier: - specifier: ^9.1.0 - version: 9.1.0(eslint@9.16.0(jiti@1.21.6)) - eslint-plugin-prettier: - specifier: ^5.2.1 - version: 5.2.1(eslint-config-prettier@9.1.0(eslint@9.16.0(jiti@1.21.6)))(eslint@9.16.0(jiti@1.21.6))(prettier@3.4.2) - eslint-plugin-simple-import-sort: - specifier: ^12.1.1 - version: 12.1.1(eslint@9.16.0(jiti@1.21.6)) - eslint-plugin-solid: - specifier: ^0.14.4 - version: 0.14.4(eslint@9.16.0(jiti@1.21.6))(typescript@5.7.2) kysely-codegen: specifier: ^0.17.0 version: 0.17.0(better-sqlite3@11.7.0)(kysely@0.27.5) postcss: specifier: ^8.4.49 version: 8.4.49 - prettier: - specifier: ^3.4.2 - version: 3.4.2 - prettier-plugin-tailwindcss: - specifier: ^0.6.9 - version: 0.6.9(prettier@3.4.2) tailwindcss: specifier: ^3.4.16 version: 3.4.16 @@ -217,6 +199,59 @@ packages: resolution: {integrity: sha512-vN5p+1kl59GVKMvTHt55NzzmYVxprfJD+ql7U9NFIfKCBkYE55LYtS+WtPlaYOyzydrKI8Nezd+aZextrd+FMA==} engines: {node: '>=6.9.0'} + '@biomejs/biome@1.9.4': + resolution: {integrity: sha512-1rkd7G70+o9KkTn5KLmDYXihGoTaIGO9PIIN2ZB7UJxFrWw04CZHPYiMRjYsaDvVV7hP1dYNRLxSANLaBFGpog==} + engines: {node: '>=14.21.3'} + hasBin: true + + '@biomejs/cli-darwin-arm64@1.9.4': + resolution: {integrity: sha512-bFBsPWrNvkdKrNCYeAp+xo2HecOGPAy9WyNyB/jKnnedgzl4W4Hb9ZMzYNbf8dMCGmUdSavlYHiR01QaYR58cw==} + engines: {node: '>=14.21.3'} + cpu: [arm64] + os: [darwin] + + '@biomejs/cli-darwin-x64@1.9.4': + resolution: {integrity: sha512-ngYBh/+bEedqkSevPVhLP4QfVPCpb+4BBe2p7Xs32dBgs7rh9nY2AIYUL6BgLw1JVXV8GlpKmb/hNiuIxfPfZg==} + engines: {node: '>=14.21.3'} + cpu: [x64] + os: [darwin] + + '@biomejs/cli-linux-arm64-musl@1.9.4': + resolution: {integrity: sha512-v665Ct9WCRjGa8+kTr0CzApU0+XXtRgwmzIf1SeKSGAv+2scAlW6JR5PMFo6FzqqZ64Po79cKODKf3/AAmECqA==} + engines: {node: '>=14.21.3'} + cpu: [arm64] + os: [linux] + + '@biomejs/cli-linux-arm64@1.9.4': + resolution: {integrity: sha512-fJIW0+LYujdjUgJJuwesP4EjIBl/N/TcOX3IvIHJQNsAqvV2CHIogsmA94BPG6jZATS4Hi+xv4SkBBQSt1N4/g==} + engines: {node: '>=14.21.3'} + cpu: [arm64] + os: [linux] + + '@biomejs/cli-linux-x64-musl@1.9.4': + resolution: {integrity: sha512-gEhi/jSBhZ2m6wjV530Yy8+fNqG8PAinM3oV7CyO+6c3CEh16Eizm21uHVsyVBEB6RIM8JHIl6AGYCv6Q6Q9Tg==} + engines: {node: '>=14.21.3'} + cpu: [x64] + os: [linux] + + '@biomejs/cli-linux-x64@1.9.4': + resolution: {integrity: sha512-lRCJv/Vi3Vlwmbd6K+oQ0KhLHMAysN8lXoCI7XeHlxaajk06u7G+UsFSO01NAs5iYuWKmVZjmiOzJ0OJmGsMwg==} + engines: {node: '>=14.21.3'} + cpu: [x64] + os: [linux] + + '@biomejs/cli-win32-arm64@1.9.4': + resolution: {integrity: sha512-tlbhLk+WXZmgwoIKwHIHEBZUwxml7bRJgk0X2sPyNR3S93cdRq6XulAZRQJ17FYGGzWne0fgrXBKpl7l4M87Hg==} + engines: {node: '>=14.21.3'} + cpu: [arm64] + os: [win32] + + '@biomejs/cli-win32-x64@1.9.4': + resolution: {integrity: sha512-8Y5wMhVIPaWe6jw2H+KlEm4wP/f7EW3810ZLmDlrEEy5KvBsb9ECEfu/kMWD484ijfQ8+nIi0giMgu9g1UAuuA==} + engines: {node: '>=14.21.3'} + cpu: [x64] + os: [win32] + '@corvu/utils@0.4.2': resolution: {integrity: sha512-Ox2kYyxy7NoXdKWdHeDEjZxClwzO4SKM8plAaVwmAJPxHMqA0rLOoAsa+hBDwRLpctf+ZRnAd/ykguuJidnaTA==} peerDependencies: @@ -491,10 +526,6 @@ packages: resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} engines: {node: '>=14'} - '@pkgr/core@0.1.1': - resolution: {integrity: sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==} - engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} - '@rollup/rollup-android-arm-eabi@4.28.1': resolution: {integrity: sha512-2aZp8AES04KI2dy3Ss6/MDjXbwBzj+i0GqKtWXgw2/Ma6E4jJvujryO6gJAghIRVz7Vwr9Gtl/8na3nDUKpraQ==} cpu: [arm] @@ -1035,37 +1066,6 @@ packages: resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} engines: {node: '>=10'} - eslint-config-prettier@9.1.0: - resolution: {integrity: sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==} - hasBin: true - peerDependencies: - eslint: '>=7.0.0' - - eslint-plugin-prettier@5.2.1: - resolution: {integrity: sha512-gH3iR3g4JfF+yYPaJYkN7jEl9QbweL/YfkoRlNnuIEHEz1vHVlCmWOS+eGGiRuzHQXdJFCOTxRgvju9b8VUmrw==} - engines: {node: ^14.18.0 || >=16.0.0} - peerDependencies: - '@types/eslint': '>=8.0.0' - eslint: '>=8.0.0' - eslint-config-prettier: '*' - prettier: '>=3.0.0' - peerDependenciesMeta: - '@types/eslint': - optional: true - eslint-config-prettier: - optional: true - - eslint-plugin-simple-import-sort@12.1.1: - resolution: {integrity: sha512-6nuzu4xwQtE3332Uz0to+TxDQYRLTKRESSc2hefVT48Zc8JthmN23Gx9lnYhu0FtkRSL1oxny3kJ2aveVhmOVA==} - peerDependencies: - eslint: '>=5.0.0' - - eslint-plugin-solid@0.14.4: - resolution: {integrity: sha512-uWsNA2okBgwBRPxjsQ7DxlRksq1EKdMhwQlViHdkkRDLnWqwnZEjQASWeckZ0DI24sVzPeETJhPv1BWKKiu99A==} - engines: {node: '>=18.0.0'} - peerDependencies: - eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0 - eslint-scope@8.2.0: resolution: {integrity: sha512-PHlWUfG6lvPc3yvP5A4PNyBL1W8fkDUccmI21JUu/+GKZBoH/W5u6usENXUrWFRsyoW5ACUjFGgAFQp5gUlb/A==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -1115,9 +1115,6 @@ packages: fast-deep-equal@3.1.3: resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} - fast-diff@1.3.0: - resolution: {integrity: sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==} - fast-glob@3.3.2: resolution: {integrity: sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==} engines: {node: '>=8.6.0'} @@ -1231,10 +1228,6 @@ packages: html-entities@2.3.3: resolution: {integrity: sha512-DV5Ln36z34NNTDgnz0EWGBLZENelNAtkiFA4kyNOG2tDI6Mz1uSWiq1wAKdyjnJwyDiDO7Fa2SO1CTxPXL8VxA==} - html-tags@3.3.1: - resolution: {integrity: sha512-ztqyC3kLto0e9WbNp0aeP+M3kTt+nbaIveGmUxAtZa+8iFgKLUOD4YKM5j+f3QD89bra7UeumolZHKuOXnTmeQ==} - engines: {node: '>=8'} - ieee754@1.2.1: resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} @@ -1260,9 +1253,6 @@ packages: ini@1.3.8: resolution: {integrity: sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==} - inline-style-parser@0.2.4: - resolution: {integrity: sha512-0aO8FkhNZlj/ZIbNi7Lxxr12obT7cL1moPfE4tg1LkX7LlLfC6DeX4l2ZEud1ukP9jNQyNnfzQVqwbwmAATY4Q==} - interpret@1.4.0: resolution: {integrity: sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==} engines: {node: '>= 0.10'} @@ -1287,10 +1277,6 @@ packages: resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} engines: {node: '>=0.10.0'} - is-html@2.0.0: - resolution: {integrity: sha512-S+OpgB5i7wzIue/YSE5hg0e5ZYfG3hhpNh9KGl6ayJ38p7ED6wxQLd1TV91xHpcTvw90KMJ9EwN3F/iNflHBVg==} - engines: {node: '>=8'} - is-number@7.0.0: resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} engines: {node: '>=0.12.0'} @@ -1335,15 +1321,9 @@ packages: engines: {node: '>=6'} hasBin: true - kebab-case@1.0.2: - resolution: {integrity: sha512-7n6wXq4gNgBELfDCpzKc+mRrZFs7D+wgfF5WRFLNAr4DA/qtr9Js8uOAVAfHhuLMfAcQ0pRKqbpjx+TcJVdE1Q==} - keyv@4.5.4: resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==} - known-css-properties@0.30.0: - resolution: {integrity: sha512-VSWXYUnsPu9+WYKkfmJyLKtIvaRJi1kXUqVmBACORXZQxT5oZDsoZ2vQP+bQFDnWtpI/4eq3MLoRMjI2fnLzTQ==} - kysely-codegen@0.17.0: resolution: {integrity: sha512-C36g6epial8cIOSBEWGI9sRfkKSsEzTcivhjPivtYFQnhMdXnrVFaUe7UMZHeSdXaHiWDqDOkReJgWLD8nPKdg==} hasBin: true @@ -1606,70 +1586,6 @@ packages: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} - prettier-linter-helpers@1.0.0: - resolution: {integrity: sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==} - engines: {node: '>=6.0.0'} - - prettier-plugin-tailwindcss@0.6.9: - resolution: {integrity: sha512-r0i3uhaZAXYP0At5xGfJH876W3HHGHDp+LCRUJrs57PBeQ6mYHMwr25KH8NPX44F2yGTvdnH7OqCshlQx183Eg==} - engines: {node: '>=14.21.3'} - peerDependencies: - '@ianvs/prettier-plugin-sort-imports': '*' - '@prettier/plugin-pug': '*' - '@shopify/prettier-plugin-liquid': '*' - '@trivago/prettier-plugin-sort-imports': '*' - '@zackad/prettier-plugin-twig-melody': '*' - prettier: ^3.0 - prettier-plugin-astro: '*' - prettier-plugin-css-order: '*' - prettier-plugin-import-sort: '*' - prettier-plugin-jsdoc: '*' - prettier-plugin-marko: '*' - prettier-plugin-multiline-arrays: '*' - prettier-plugin-organize-attributes: '*' - prettier-plugin-organize-imports: '*' - prettier-plugin-sort-imports: '*' - prettier-plugin-style-order: '*' - prettier-plugin-svelte: '*' - peerDependenciesMeta: - '@ianvs/prettier-plugin-sort-imports': - optional: true - '@prettier/plugin-pug': - optional: true - '@shopify/prettier-plugin-liquid': - optional: true - '@trivago/prettier-plugin-sort-imports': - optional: true - '@zackad/prettier-plugin-twig-melody': - optional: true - prettier-plugin-astro: - optional: true - prettier-plugin-css-order: - optional: true - prettier-plugin-import-sort: - optional: true - prettier-plugin-jsdoc: - optional: true - prettier-plugin-marko: - optional: true - prettier-plugin-multiline-arrays: - optional: true - prettier-plugin-organize-attributes: - optional: true - prettier-plugin-organize-imports: - optional: true - prettier-plugin-sort-imports: - optional: true - prettier-plugin-style-order: - optional: true - prettier-plugin-svelte: - optional: true - - prettier@3.4.2: - resolution: {integrity: sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==} - engines: {node: '>=14'} - hasBin: true - pump@3.0.2: resolution: {integrity: sha512-tUPXtzlGM8FE3P0ZL6DVs/3P58k9nk8/jZeQCurTJylQA8qFYzHFfhBJkuqyE0FifOsQ0uKWekiZ5g8wtr28cw==} @@ -1820,9 +1736,6 @@ packages: resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} engines: {node: '>=8'} - style-to-object@1.0.8: - resolution: {integrity: sha512-xT47I/Eo0rwJmaXC4oilDGDWLohVhR6o/xAQcPQN8q6QBuZVL8qMYL85kLmST5cPjAorwvqIA4qXTRQoYHaL6g==} - sucrase@3.35.0: resolution: {integrity: sha512-8EbVDiu9iN/nESwxeSxDKe0dunta1GOlHufmSSXxMD2z2/tMZpDMpvXQGsc+ajGo8y2uYUmixaSRUc/QPoQ0GA==} engines: {node: '>=16 || 14 >=14.17'} @@ -1840,10 +1753,6 @@ packages: resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} engines: {node: '>= 0.4'} - synckit@0.9.2: - resolution: {integrity: sha512-vrozgXDQwYO72vHjUb/HnFbQx1exDjoKzqx23aXEg2a9VIg2TSFZ8FmeZpTjUCFMYw7mpX4BE2SFu8wI7asYsw==} - engines: {node: ^14.18.0 || >=16.0.0} - tailwind-merge@2.5.5: resolution: {integrity: sha512-0LXunzzAZzo0tEPxV3I297ffKZPlKDrjj7NXphC8V5ak9yHC5zRmxnOe2m/Rd/7ivsOMJe3JZ2JVocoDdQTRBA==} @@ -2135,6 +2044,41 @@ snapshots: '@babel/helper-string-parser': 7.25.9 '@babel/helper-validator-identifier': 7.25.9 + '@biomejs/biome@1.9.4': + optionalDependencies: + '@biomejs/cli-darwin-arm64': 1.9.4 + '@biomejs/cli-darwin-x64': 1.9.4 + '@biomejs/cli-linux-arm64': 1.9.4 + '@biomejs/cli-linux-arm64-musl': 1.9.4 + '@biomejs/cli-linux-x64': 1.9.4 + '@biomejs/cli-linux-x64-musl': 1.9.4 + '@biomejs/cli-win32-arm64': 1.9.4 + '@biomejs/cli-win32-x64': 1.9.4 + + '@biomejs/cli-darwin-arm64@1.9.4': + optional: true + + '@biomejs/cli-darwin-x64@1.9.4': + optional: true + + '@biomejs/cli-linux-arm64-musl@1.9.4': + optional: true + + '@biomejs/cli-linux-arm64@1.9.4': + optional: true + + '@biomejs/cli-linux-x64-musl@1.9.4': + optional: true + + '@biomejs/cli-linux-x64@1.9.4': + optional: true + + '@biomejs/cli-win32-arm64@1.9.4': + optional: true + + '@biomejs/cli-win32-x64@1.9.4': + optional: true + '@corvu/utils@0.4.2(solid-js@1.9.3)': dependencies: '@floating-ui/dom': 1.6.12 @@ -2355,8 +2299,6 @@ snapshots: '@pkgjs/parseargs@0.11.0': optional: true - '@pkgr/core@0.1.1': {} - '@rollup/rollup-android-arm-eabi@4.28.1': optional: true @@ -2889,36 +2831,6 @@ snapshots: escape-string-regexp@4.0.0: {} - eslint-config-prettier@9.1.0(eslint@9.16.0(jiti@1.21.6)): - dependencies: - eslint: 9.16.0(jiti@1.21.6) - - eslint-plugin-prettier@5.2.1(eslint-config-prettier@9.1.0(eslint@9.16.0(jiti@1.21.6)))(eslint@9.16.0(jiti@1.21.6))(prettier@3.4.2): - dependencies: - eslint: 9.16.0(jiti@1.21.6) - prettier: 3.4.2 - prettier-linter-helpers: 1.0.0 - synckit: 0.9.2 - optionalDependencies: - eslint-config-prettier: 9.1.0(eslint@9.16.0(jiti@1.21.6)) - - eslint-plugin-simple-import-sort@12.1.1(eslint@9.16.0(jiti@1.21.6)): - dependencies: - eslint: 9.16.0(jiti@1.21.6) - - eslint-plugin-solid@0.14.4(eslint@9.16.0(jiti@1.21.6))(typescript@5.7.2): - dependencies: - '@typescript-eslint/utils': 8.17.0(eslint@9.16.0(jiti@1.21.6))(typescript@5.7.2) - eslint: 9.16.0(jiti@1.21.6) - estraverse: 5.3.0 - is-html: 2.0.0 - kebab-case: 1.0.2 - known-css-properties: 0.30.0 - style-to-object: 1.0.8 - transitivePeerDependencies: - - supports-color - - typescript - eslint-scope@8.2.0: dependencies: esrecurse: 4.3.0 @@ -2991,8 +2903,6 @@ snapshots: fast-deep-equal@3.1.3: {} - fast-diff@1.3.0: {} - fast-glob@3.3.2: dependencies: '@nodelib/fs.stat': 2.0.5 @@ -3103,8 +3013,6 @@ snapshots: html-entities@2.3.3: {} - html-tags@3.3.1: {} - ieee754@1.2.1: {} ignore@5.3.2: {} @@ -3125,8 +3033,6 @@ snapshots: ini@1.3.8: {} - inline-style-parser@0.2.4: {} - interpret@1.4.0: {} is-binary-path@2.1.0: @@ -3145,10 +3051,6 @@ snapshots: dependencies: is-extglob: 2.1.1 - is-html@2.0.0: - dependencies: - html-tags: 3.3.1 - is-number@7.0.0: {} is-what@4.1.16: {} @@ -3179,14 +3081,10 @@ snapshots: json5@2.2.3: {} - kebab-case@1.0.2: {} - keyv@4.5.4: dependencies: json-buffer: 3.0.1 - known-css-properties@0.30.0: {} - kysely-codegen@0.17.0(better-sqlite3@11.7.0)(kysely@0.27.5): dependencies: chalk: 4.1.2 @@ -3396,16 +3294,6 @@ snapshots: prelude-ls@1.2.1: {} - prettier-linter-helpers@1.0.0: - dependencies: - fast-diff: 1.3.0 - - prettier-plugin-tailwindcss@0.6.9(prettier@3.4.2): - dependencies: - prettier: 3.4.2 - - prettier@3.4.2: {} - pump@3.0.2: dependencies: end-of-stream: 1.4.4 @@ -3572,10 +3460,6 @@ snapshots: strip-json-comments@3.1.1: {} - style-to-object@1.0.8: - dependencies: - inline-style-parser: 0.2.4 - sucrase@3.35.0: dependencies: '@jridgewell/gen-mapping': 0.3.5 @@ -3596,11 +3480,6 @@ snapshots: supports-preserve-symlinks-flag@1.0.0: {} - synckit@0.9.2: - dependencies: - '@pkgr/core': 0.1.1 - tslib: 2.8.1 - tailwind-merge@2.5.5: {} tailwindcss-animate@1.0.7(tailwindcss@3.4.16): diff --git a/prettier.config.js b/prettier.config.js deleted file mode 100644 index 9677300..0000000 --- a/prettier.config.js +++ /dev/null @@ -1,9 +0,0 @@ -export default { - semi: true, - trailingComma: "all", - singleQuote: false, - printWidth: 120, - tabWidth: 2, - singleAttributePerLine: true, - plugins: ["prettier-plugin-tailwindcss"], -}; diff --git a/src/App.tsx b/src/App.tsx index 925f2d0..8b233ac 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -9,22 +9,10 @@ import "./app.css"; const App: Component = () => { return ( <> - - - - + + + + { diff --git a/src/app.css b/src/app.css index 82e8f87..87559af 100644 --- a/src/app.css +++ b/src/app.css @@ -101,9 +101,7 @@ } body { @apply bg-background text-foreground; - font-feature-settings: - "rlig" 1, - "calt" 1; + font-feature-settings: "rlig" 1, "calt" 1; } } diff --git a/src/components/ui/charts.tsx b/src/components/ui/charts.tsx index 6a9a215..f6717aa 100644 --- a/src/components/ui/charts.tsx +++ b/src/components/ui/charts.tsx @@ -94,8 +94,11 @@ const BaseChart: Component = (rawProps) => { on( () => props.data, () => { - chart()!.data = props.data; - chart()!.update(); + const currentChart = chart(); + if (currentChart) { + currentChart.data = props.data; + currentChart.update(); + } }, { defer: true }, ), @@ -105,8 +108,11 @@ const BaseChart: Component = (rawProps) => { on( () => props.options, () => { - chart()!.options = props.options; - chart()!.update(); + const currentChart = chart(); + if (currentChart) { + currentChart.options = props.options; + currentChart.update(); + } }, { defer: true }, ), @@ -116,7 +122,10 @@ const BaseChart: Component = (rawProps) => { on( [() => props.width, () => props.height], () => { - chart()!.resize(props.width, props.height); + const currentChart = chart(); + if (currentChart) { + currentChart.resize(props.width, props.height); + } }, { defer: true }, ), @@ -126,10 +135,13 @@ const BaseChart: Component = (rawProps) => { on( () => props.type, () => { - const dimensions = [chart()!.width, chart()!.height]; - chart()!.destroy(); - init(); - chart()!.resize(...dimensions); + const currentChart = chart(); + if (currentChart) { + const dimensions = [currentChart.width, currentChart.height]; + currentChart.destroy(); + init(); + currentChart.resize(...dimensions); + } }, { defer: true }, ), @@ -141,13 +153,7 @@ const BaseChart: Component = (rawProps) => { }); Chart.register(Colors, Filler, Legend, Tooltip); - return ( - setCanvasRef(el))} - height={props.height} - width={props.width} - /> - ); + return setCanvasRef(el))} height={props.height} width={props.width} />; }; function showTooltip(context: ChartContext) { @@ -245,13 +251,7 @@ function createTypedChart(type: ChartType, components: ChartComponent[]): Compon }; Chart.register(...components); - return (props) => ( - - ); + return (props) => ; } const BarChart = /* #__PURE__ */ createTypedChart("bar", [BarController, BarElement, CategoryScale, LinearScale]); diff --git a/src/components/ui/checkbox.tsx b/src/components/ui/checkbox.tsx index 45e8b61..0d280f8 100644 --- a/src/components/ui/checkbox.tsx +++ b/src/components/ui/checkbox.tsx @@ -13,10 +13,7 @@ type CheckboxRootProps = CheckboxPrimitive.Che const Checkbox = (props: PolymorphicProps>) => { const [local, others] = splitProps(props as CheckboxRootProps, ["class"]); return ( - + diff --git a/src/components/ui/label.tsx b/src/components/ui/label.tsx index ec430f5..74942f9 100644 --- a/src/components/ui/label.tsx +++ b/src/components/ui/label.tsx @@ -8,7 +8,7 @@ const Label: Component> = (props) => { return (