Skip to content

Commit d86a634

Browse files
authored
Merge pull request #372 from OpenGeoscience/prettier
Enable Prettier for frontend formatting
2 parents cbd074d + 2d381de commit d86a634

50 files changed

Lines changed: 8323 additions & 6089 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.git-blame-ignore-revs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Switch to double quotes
22
052ad665aceaf8ef10ffc3eba8111799517e2cae
3-
43
# Revert internal name to "uvdat"
54
4db15705dbcb5c2b1be39e96990804cdf03fbf1b
5+
# Format with Prettier
6+
c5e40b27cd426c9665e28db54dc092d3997eb718

web/env.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/// <reference types="vite/client" />
22

33
interface ViteTypeOptions {
4-
strictImportMetaEnv: unknown
4+
strictImportMetaEnv: unknown;
55
}
66

77
interface ImportMetaEnv {

web/eslint.config.ts

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,34 @@
1-
import { globalIgnores } from 'eslint/config'
2-
import pluginVue from 'eslint-plugin-vue'
3-
import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript'
4-
import skipFormatting from 'eslint-config-prettier/flat'
1+
import { globalIgnores } from "eslint/config";
2+
import pluginVue from "eslint-plugin-vue";
3+
import {
4+
defineConfigWithVueTs,
5+
vueTsConfigs,
6+
} from "@vue/eslint-config-typescript";
7+
import skipFormatting from "eslint-config-prettier/flat";
58

69
export default defineConfigWithVueTs(
710
{
8-
name: 'app/files-to-lint',
9-
files: ['**/*.{vue,ts,mts,tsx}'],
11+
name: "app/files-to-lint",
12+
files: ["**/*.{vue,ts,mts,tsx}"],
1013
},
11-
globalIgnores(['**/dist/**', '**/dist-ssr/**', '**/coverage/**']),
12-
...pluginVue.configs['flat/essential'],
14+
globalIgnores(["**/dist/**", "**/dist-ssr/**", "**/coverage/**"]),
15+
...pluginVue.configs["flat/essential"],
1316
vueTsConfigs.recommended,
1417
{
1518
rules: {
1619
// allowModifiers: Vuetify uses dot notation for column slots (v-slot:item.columnName)
17-
'vue/valid-v-slot': ['error', { allowModifiers: true }],
20+
"vue/valid-v-slot": ["error", { allowModifiers: true }],
1821
// `any` is used everywhere and will be difficult to eliminate
19-
'@typescript-eslint/no-explicit-any': 'off',
22+
"@typescript-eslint/no-explicit-any": "off",
2023
// Temporary ignores until rules can be fixed
21-
'vue/require-v-for-key': 'off',
22-
'vue/valid-v-for': 'off',
23-
'vue/return-in-computed-property': 'off',
24-
'vue/no-ref-as-operand': 'off',
25-
'vue/no-side-effects-in-computed-properties': 'off',
26-
'vue/no-async-in-computed-properties': 'off',
27-
'vue/no-use-v-if-with-v-for': 'off',
24+
"vue/require-v-for-key": "off",
25+
"vue/valid-v-for": "off",
26+
"vue/return-in-computed-property": "off",
27+
"vue/no-ref-as-operand": "off",
28+
"vue/no-side-effects-in-computed-properties": "off",
29+
"vue/no-async-in-computed-properties": "off",
30+
"vue/no-use-v-if-with-v-for": "off",
2831
},
2932
},
3033
skipFormatting,
31-
)
34+
);

web/index.html

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,32 @@
1-
<!DOCTYPE html>
2-
<html lang="" style="overflow: hidden;">
3-
4-
<head>
5-
<meta charset="utf-8">
6-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7-
<meta name="viewport" content="width=device-width,initial-scale=1.0">
8-
<link rel="preconnect" href="https://fonts.googleapis.com">
9-
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
10-
<link href="https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap" rel="stylesheet">
11-
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0&icon_names=format_line_spacing,straighten" />
12-
<link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32">
13-
<title>GeoDatalytics</title>
14-
</head>
15-
16-
<body>
17-
<noscript>
18-
<strong>We're sorry but GeoDatalytics doesn't work properly without JavaScript enabled.
19-
Please enable it to continue.</strong>
20-
</noscript>
21-
<div id="app"></div>
22-
<script type="module" src="/src/main.ts"></script>
23-
<!-- built files will be auto injected -->
24-
</body>
1+
<!doctype html>
2+
<html lang="" style="overflow: hidden">
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
6+
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
7+
<link rel="preconnect" href="https://fonts.googleapis.com" />
8+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
9+
<link
10+
href="https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap"
11+
rel="stylesheet"
12+
/>
13+
<link
14+
rel="stylesheet"
15+
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0&icon_names=format_line_spacing,straighten"
16+
/>
17+
<link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32" />
18+
<title>GeoDatalytics</title>
19+
</head>
2520

21+
<body>
22+
<noscript>
23+
<strong
24+
>We're sorry but GeoDatalytics doesn't work properly without JavaScript
25+
enabled. Please enable it to continue.</strong
26+
>
27+
</noscript>
28+
<div id="app"></div>
29+
<script type="module" src="/src/main.ts"></script>
30+
<!-- built files will be auto injected -->
31+
</body>
2632
</html>

web/package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@
77
"serve": "vite",
88
"serve:prod": "vite preview",
99
"build": "vite build",
10-
"test:lint": "eslint . --no-fix",
10+
"test:format": "prettier --experimental-cli --check .",
11+
"test:lint": "eslint --no-fix .",
1112
"test:type": "vue-tsc --build",
12-
"test": "npm-run-all test:lint test:type",
13-
"format": "eslint . --fix"
13+
"test": "npm-run-all test:format test:lint test:type",
14+
"format:lint": "eslint --fix .",
15+
"format:format": "prettier --experimental-cli --write .",
16+
"format": "npm-run-all format:lint format:format"
1417
},
1518
"dependencies": {
1619
"@mdi/font": "7.4.47",

web/src/App.vue

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ import ToggleCompareMap from "./components/map/ToggleCompareMap.vue";
77
import SideBars from "./components/sidebars/SideBars.vue";
88
import ControlsBar from "./components/ControlsBar.vue";
99
10-
import { useAppStore, usePanelStore, useProjectStore, useConversionStore } from "@/store";
10+
import {
11+
useAppStore,
12+
usePanelStore,
13+
useProjectStore,
14+
useConversionStore,
15+
} from "@/store";
1116
const appStore = useAppStore();
1217
const panelStore = usePanelStore();
1318
const projectStore = useProjectStore();
@@ -16,7 +21,7 @@ const conversionStore = useConversionStore();
1621
const showError = computed(() => appStore.currentError !== undefined);
1722
1823
// useTheme must be called within a setup function
19-
appStore.themeManager = useTheme()
24+
appStore.themeManager = useTheme();
2025
2126
function onReady() {
2227
if (appStore.currentUser) {
@@ -32,7 +37,6 @@ const login = () => {
3237
3338
onMounted(onReady);
3439
watch(() => appStore.currentUser, onReady);
35-
3640
</script>
3741

3842
<template>

web/src/api/auth.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import axios from "axios";
22
import OauthClient from "@resonant/oauth-client";
3-
import S3FileFieldClient from 'django-s3-file-field';
3+
import S3FileFieldClient from "django-s3-file-field";
44
import { useAppStore } from "@/store";
55

6-
declare module 'axios' {
6+
declare module "axios" {
77
interface AxiosRequestConfig {
88
errorMsg?: string;
99
}
1010
}
1111

12-
const OAUTH2_CLIENT_ID = 'cBmD6D6F2YAmMWHNQZFPUr4OpaXVpW5w4Thod6Kj';
12+
const OAUTH2_CLIENT_ID = "cBmD6D6F2YAmMWHNQZFPUr4OpaXVpW5w4Thod6Kj";
1313

1414
export const baseURL = `${import.meta.env.VITE_APP_API_ROOT}api/v1/`;
1515

@@ -19,13 +19,13 @@ export const apiClient = axios.create({
1919
export const oauthClient = new OauthClient(
2020
new URL(`${import.meta.env.VITE_APP_API_ROOT}oauth/`),
2121
OAUTH2_CLIENT_ID,
22-
{ redirectUrl: new URL(window.location.origin) }
22+
{ redirectUrl: new URL(window.location.origin) },
2323
);
2424

2525
export let s3ffClient: S3FileFieldClient = new S3FileFieldClient({
26-
baseUrl: baseURL + 's3-upload/',
26+
baseUrl: baseURL + "s3-upload/",
2727
// This lacks auth headers, but they'll be added once logged in.
28-
})
28+
});
2929

3030
export async function restoreLogin() {
3131
if (!oauthClient) {
@@ -39,11 +39,11 @@ export async function restoreLogin() {
3939
}
4040
});
4141
s3ffClient = new S3FileFieldClient({
42-
baseUrl: baseURL + 's3-upload/',
42+
baseUrl: baseURL + "s3-upload/",
4343
apiConfig: {
44-
headers: oauthClient.authHeaders
45-
}
46-
})
44+
headers: oauthClient.authHeaders,
45+
},
46+
});
4747
}
4848
}
4949

@@ -60,7 +60,7 @@ apiClient.interceptors.response.use(
6060
const appStore = useAppStore();
6161

6262
if (error.config?.errorMsg) {
63-
appStore.currentError = error.config?.errorMsg
63+
appStore.currentError = error.config?.errorMsg;
6464
return { data: undefined };
6565
}
6666

@@ -76,10 +76,10 @@ apiClient.interceptors.response.use(
7676
appStore.currentError = "An error occurred.";
7777
}
7878
return { data: undefined };
79-
}
79+
},
8080
);
8181

8282
export const logout = async () => {
8383
await oauthClient.logout();
84-
window.location.href = `${import.meta.env.VITE_APP_API_ROOT}accounts/logout/`
84+
window.location.href = `${import.meta.env.VITE_APP_API_ROOT}accounts/logout/`;
8585
};

0 commit comments

Comments
 (0)