Skip to content

Commit

Permalink
chore: web: format with prettier and lint with eslint (#224)
Browse files Browse the repository at this point in the history
  • Loading branch information
crlssn authored Dec 15, 2024
1 parent 0a519e1 commit cc17946
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 199 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/test.web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -41,4 +43,3 @@ jobs:
- name: Build the app
working-directory: ./web
run: npm run build
shell: bash
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ format:
lint:
golangci-lint run
buf lint
cd web && npm run lint

vet:
go vet ./...
1 change: 0 additions & 1 deletion web/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

{
"$schema": "https://json.schemastore.org/prettierrc",
"semi": false,
Expand Down
4 changes: 2 additions & 2 deletions web/env.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/// <reference types="vite/client" />

interface ImportMetaEnv {
readonly VITE_API_URL: string;
readonly VITE_API_URL: string
}

interface ImportMeta {
readonly env: ImportMetaEnv;
readonly env: ImportMetaEnv
}
38 changes: 0 additions & 38 deletions web/eslint.config.js
Original file line number Diff line number Diff line change
@@ -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 [
Expand All @@ -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'],
},
}
]
11 changes: 7 additions & 4 deletions web/index.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<!DOCTYPE html>
<!doctype html>
<html lang="" class="h-full bg-gray-100">
<head>
<meta charset="UTF-8">
<link rel="icon" href="/favicon.png">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.png" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
/>
<title>GetStronger</title>
</head>
<body class="h-full" id="app">
Expand Down
145 changes: 7 additions & 138 deletions web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 1 addition & 2 deletions web/src/ui/users/UserPersonalBests.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<script setup lang="ts">
import AppListItem from '@/ui/components/AppListItem.vue'
import AppList from '@/ui/components/AppList.vue'
import { onMounted, ref } from 'vue'
import type { PersonalBest } from '@/proto/api/v1/exercise_service_pb.ts'
import { getPersonalBests } from '@/http/requests.ts'
import { useRoute } from 'vue-router'
import { usePageTitleStore } from '@/stores/pageTitle.ts'
import AppListItemLink from '@/ui/components/AppListItemLink.vue'
import { formatToRelativeDateTime, formatUnixToRelativeDateTime } from '@/utils/datetime.ts'
import { formatToRelativeDateTime } from '@/utils/datetime.ts'
const props = defineProps<{
id: string
Expand Down
3 changes: 1 addition & 2 deletions web/tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "@vue/tsconfig/tsconfig.dom.json",
"include": [
"env.d.ts", "src/**/*", "src/**/*.vue"],
"include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
"exclude": ["src/**/__tests__/*"],
"compilerOptions": {
"composite": true,
Expand Down
5 changes: 1 addition & 4 deletions web/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{
"extends": "@tsconfig/node20/tsconfig.json",
"include": [
"vite.config.*",
"vitest.config.*",
],
"include": ["vite.config.*", "vitest.config.*"],
"compilerOptions": {
"composite": true,
"noEmit": true,
Expand Down
2 changes: 1 addition & 1 deletion web/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default defineConfig({
},
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
})

0 comments on commit cc17946

Please sign in to comment.