From cc17946c233c9a852989f5a1ac5779d0ac06276a Mon Sep 17 00:00:00 2001 From: Christian Carlsson Date: Sun, 15 Dec 2024 17:41:17 +0000 Subject: [PATCH] chore: web: format with prettier and lint with eslint (#224) --- .github/workflows/test.web.yml | 7 +- Makefile | 1 + web/.prettierrc.json | 1 - web/env.d.ts | 4 +- web/eslint.config.js | 38 ------- web/index.html | 11 +- web/package-lock.json | 145 ++----------------------- web/package.json | 6 +- web/src/ui/users/UserPersonalBests.vue | 3 +- web/tsconfig.app.json | 3 +- web/tsconfig.node.json | 5 +- web/vite.config.ts | 2 +- 12 files changed, 27 insertions(+), 199 deletions(-) diff --git a/.github/workflows/test.web.yml b/.github/workflows/test.web.yml index ae78b006..fc243da8 100644 --- a/.github/workflows/test.web.yml +++ b/.github/workflows/test.web.yml @@ -24,12 +24,14 @@ jobs: - name: Install dependencies working-directory: ./web run: npm install - shell: bash + + - name: Run linter + working-directory: ./web + run: npm run lint - name: Run formatter working-directory: ./web run: npm run format - shell: bash - name: Check for uncommitted changes run: | @@ -41,4 +43,3 @@ jobs: - name: Build the app working-directory: ./web run: npm run build - shell: bash diff --git a/Makefile b/Makefile index 2779cbf0..22086d56 100644 --- a/Makefile +++ b/Makefile @@ -46,6 +46,7 @@ format: lint: golangci-lint run buf lint + cd web && npm run lint vet: go vet ./... diff --git a/web/.prettierrc.json b/web/.prettierrc.json index 17a23d07..29a2402e 100644 --- a/web/.prettierrc.json +++ b/web/.prettierrc.json @@ -1,4 +1,3 @@ - { "$schema": "https://json.schemastore.org/prettierrc", "semi": false, diff --git a/web/env.d.ts b/web/env.d.ts index 29c29a18..b54b4c98 100644 --- a/web/env.d.ts +++ b/web/env.d.ts @@ -1,9 +1,9 @@ /// interface ImportMetaEnv { - readonly VITE_API_URL: string; + readonly VITE_API_URL: string } interface ImportMeta { - readonly env: ImportMetaEnv; + readonly env: ImportMetaEnv } diff --git a/web/eslint.config.js b/web/eslint.config.js index 5101986e..700b3e7b 100644 --- a/web/eslint.config.js +++ b/web/eslint.config.js @@ -1,6 +1,4 @@ -import pluginVue from 'eslint-plugin-vue' import pluginVitest from '@vitest/eslint-plugin' -import perfectionist from 'eslint-plugin-perfectionist' import vueTsEslintConfig from '@vue/eslint-config-typescript' export default [ @@ -14,46 +12,10 @@ export default [ name: 'app/files-to-ignore', }, - ...pluginVue.configs['flat/recommended'], ...vueTsEslintConfig(), { ...pluginVitest.configs.recommended, files: ['src/**/__tests__/*'], }, - - - { - plugins: { - perfectionist, - }, - rules: { - 'perfectionist/sort-array-includes': ['error'], - 'perfectionist/sort-classes': ['error'], - 'perfectionist/sort-decorators': ['error'], - 'perfectionist/sort-enums': ['error'], - 'perfectionist/sort-exports': ['error'], - 'perfectionist/sort-heritage-clauses': ['error'], - 'perfectionist/sort-imports': [ - 'error', - { - order: 'asc', - type: 'line-length', - }, - ], - 'perfectionist/sort-interfaces': ['error'], - 'perfectionist/sort-intersection-types': ['error'], - 'perfectionist/sort-jsx-props': ['error'], - 'perfectionist/sort-maps': ['error'], - 'perfectionist/sort-modules': ['error'], - 'perfectionist/sort-named-exports': ['error'], - 'perfectionist/sort-named-imports': ['error'], - 'perfectionist/sort-object-types': ['error'], - 'perfectionist/sort-objects': ['error'], - 'perfectionist/sort-sets': ['error'], - 'perfectionist/sort-switch-case': ['error'], - 'perfectionist/sort-union-types': ['error'], - 'perfectionist/sort-variable-declarations': ['error'], - }, - } ] diff --git a/web/index.html b/web/index.html index 73ca4e58..509ef534 100644 --- a/web/index.html +++ b/web/index.html @@ -1,9 +1,12 @@ - + - - - + + + GetStronger diff --git a/web/package-lock.json b/web/package-lock.json index 60916bde..86067c99 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -47,8 +47,6 @@ "autoprefixer": "10.4.20", "eslint": "9.16.0", "eslint-plugin-import": "2.31.0", - "eslint-plugin-perfectionist": "4.3.0", - "eslint-plugin-vue": "9.32.0", "jsdom": "25.0.1", "npm-run-all2": "7.0.1", "postcss": "8.4.49", @@ -3679,7 +3677,8 @@ "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", "dev": true, - "license": "ISC" + "license": "ISC", + "peer": true }, "node_modules/brace-expansion": { "version": "2.0.1", @@ -4925,131 +4924,6 @@ "semver": "bin/semver.js" } }, - "node_modules/eslint-plugin-perfectionist": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-perfectionist/-/eslint-plugin-perfectionist-4.3.0.tgz", - "integrity": "sha512-8tQ/wn1dFelul2WoXL/NQOEwvWO8H4Vjmsqpt3fDQrfgybr8kQ5Vgb9BQyVRB33ywQqjUApsiwi5Ci7grMPPRA==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "^8.18.0", - "@typescript-eslint/utils": "^8.18.0", - "natural-orderby": "^5.0.0" - }, - "engines": { - "node": "^18.0.0 || >=20.0.0" - }, - "peerDependencies": { - "eslint": ">=8.0.0" - } - }, - "node_modules/eslint-plugin-perfectionist/node_modules/@typescript-eslint/scope-manager": { - "version": "8.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.18.0.tgz", - "integrity": "sha512-PNGcHop0jkK2WVYGotk/hxj+UFLhXtGPiGtiaWgVBVP1jhMoMCHlTyJA+hEj4rszoSdLTK3fN4oOatrL0Cp+Xw==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "8.18.0", - "@typescript-eslint/visitor-keys": "8.18.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/eslint-plugin-perfectionist/node_modules/@typescript-eslint/types": { - "version": "8.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.18.0.tgz", - "integrity": "sha512-FNYxgyTCAnFwTrzpBGq+zrnoTO4x0c1CKYY5MuUTzpScqmY5fmsh2o3+57lqdI3NZucBDCzDgdEbIaNfAjAHQA==", - "dev": true, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/eslint-plugin-perfectionist/node_modules/@typescript-eslint/typescript-estree": { - "version": "8.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.18.0.tgz", - "integrity": "sha512-rqQgFRu6yPkauz+ms3nQpohwejS8bvgbPyIDq13cgEDbkXt4LH4OkDMT0/fN1RUtzG8e8AKJyDBoocuQh8qNeg==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "8.18.0", - "@typescript-eslint/visitor-keys": "8.18.0", - "debug": "^4.3.4", - "fast-glob": "^3.3.2", - "is-glob": "^4.0.3", - "minimatch": "^9.0.4", - "semver": "^7.6.0", - "ts-api-utils": "^1.3.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "typescript": ">=4.8.4 <5.8.0" - } - }, - "node_modules/eslint-plugin-perfectionist/node_modules/@typescript-eslint/utils": { - "version": "8.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.18.0.tgz", - "integrity": "sha512-p6GLdY383i7h5b0Qrfbix3Vc3+J2k6QWw6UMUeY5JGfm3C5LbZ4QIZzJNoNOfgyRe0uuYKjvVOsO/jD4SJO+xg==", - "dev": true, - "dependencies": { - "@eslint-community/eslint-utils": "^4.4.0", - "@typescript-eslint/scope-manager": "8.18.0", - "@typescript-eslint/types": "8.18.0", - "@typescript-eslint/typescript-estree": "8.18.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <5.8.0" - } - }, - "node_modules/eslint-plugin-perfectionist/node_modules/@typescript-eslint/visitor-keys": { - "version": "8.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.18.0.tgz", - "integrity": "sha512-pCh/qEA8Lb1wVIqNvBke8UaRjJ6wrAWkJO5yyIbs8Yx6TNGYyfNjOo61tLv+WwLvoLPp4BQ8B7AHKijl8NGUfw==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "8.18.0", - "eslint-visitor-keys": "^4.2.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/eslint-plugin-perfectionist/node_modules/eslint-visitor-keys": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", - "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", - "dev": true, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, "node_modules/eslint-plugin-prettier": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.2.1.tgz", @@ -5086,6 +4960,7 @@ "resolved": "https://registry.npmjs.org/eslint-plugin-vue/-/eslint-plugin-vue-9.32.0.tgz", "integrity": "sha512-b/Y05HYmnB/32wqVcjxjHZzNpwxj1onBOvqW89W+V+XNG1dRuaFbNd3vT9CLbr2LXjEoq+3vn8DanWf7XU22Ug==", "dev": true, + "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "globals": "^13.24.0", @@ -5109,6 +4984,7 @@ "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "type-fest": "^0.20.2" }, @@ -7124,16 +7000,6 @@ "dev": true, "license": "MIT" }, - "node_modules/natural-orderby": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/natural-orderby/-/natural-orderby-5.0.0.tgz", - "integrity": "sha512-kKHJhxwpR/Okycz4HhQKKlhWe4ASEfPgkSWNmKFHd7+ezuQlxkA5cM3+XkBPvm1gmHen3w53qsYAv+8GwRrBlg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - } - }, "node_modules/node-fetch-native": { "version": "1.6.4", "resolved": "https://registry.npmjs.org/node-fetch-native/-/node-fetch-native-1.6.4.tgz", @@ -7291,6 +7157,7 @@ "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==", "dev": true, "license": "BSD-2-Clause", + "peer": true, "dependencies": { "boolbase": "^1.0.0" }, @@ -9147,6 +9014,7 @@ "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", "dev": true, "license": "(MIT OR CC0-1.0)", + "peer": true, "engines": { "node": ">=10" }, @@ -10446,6 +10314,7 @@ "integrity": "sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==", "dev": true, "license": "Apache-2.0", + "peer": true, "engines": { "node": ">=12" } diff --git a/web/package.json b/web/package.json index ed6176e1..6bd6385b 100644 --- a/web/package.json +++ b/web/package.json @@ -10,8 +10,8 @@ "test:unit": "vitest", "build-only": "vite build", "type-check": "vue-tsc --build --force", - "lint": "eslint --fix", - "format": "prettier --write src" + "lint": "eslint .", + "format": "prettier --write ." }, "dependencies": { "@bufbuild/protobuf": "2.2.3", @@ -53,8 +53,6 @@ "autoprefixer": "10.4.20", "eslint": "9.16.0", "eslint-plugin-import": "2.31.0", - "eslint-plugin-perfectionist": "4.3.0", - "eslint-plugin-vue": "9.32.0", "jsdom": "25.0.1", "npm-run-all2": "7.0.1", "postcss": "8.4.49", diff --git a/web/src/ui/users/UserPersonalBests.vue b/web/src/ui/users/UserPersonalBests.vue index 9101bd70..a7a1a762 100644 --- a/web/src/ui/users/UserPersonalBests.vue +++ b/web/src/ui/users/UserPersonalBests.vue @@ -1,5 +1,4 @@