Skip to content

Commit

Permalink
fix: prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
goranbs committed Mar 22, 2024
1 parent 7544af9 commit 2ffe2cd
Show file tree
Hide file tree
Showing 40 changed files with 1,467 additions and 1,374 deletions.
32 changes: 19 additions & 13 deletions frontend/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,31 @@ module.exports = {
'import/newline-after-import': 'warn',
'import/no-duplicates': 'warn',
'import/no-extraneous-dependencies': 'off',
'simple-import-sort/imports': ['warn', {
groups: [
['^\\u0000'],
['^@?\\w', '^@?\\w.*\\u0000$'],
['(?<!\\u0000)$', '(?<=\\u0000)$'],
['^\\.', '^\\..*\\u0000$'],
],
}],
'simple-import-sort/imports': [
'warn',
{
groups: [
['^\\u0000'],
['^@?\\w', '^@?\\w.*\\u0000$'],
['(?<!\\u0000)$', '(?<=\\u0000)$'],
['^\\.', '^\\..*\\u0000$']
]
}
],
'import/prefer-default-export': 'off',
'import/no-mutable-exports': 'off',
'simple-import-sort/exports': 'warn',
'@typescript-eslint/explicit-function-return-type': 'error',
'no-return-await': 'off',
'@typescript-eslint/return-await': 'off',
'indent': 'off',
indent: 'off',
'function-paren-newline': 'off',
'@typescript-eslint/consistent-type-imports': ['warn', {
prefer: 'type-imports',
}],
'@typescript-eslint/consistent-type-imports': [
'warn',
{
prefer: 'type-imports'
}
],
'unicorn/no-useless-undefined': 'off',
'unicorn/no-array-for-each': 'off',
'no-console': 'off',
Expand All @@ -72,6 +78,6 @@ module.exports = {
'no-shadow': 'off',
'@typescript-eslint/no-shadow': 'off',
'simple-import-sort/imports': 'off',
'@typescript-eslint/explicit-function-return-type': [{'allowExpressions': true}],
'@typescript-eslint/explicit-function-return-type': [{ allowExpressions: true }]
}
};
46 changes: 20 additions & 26 deletions frontend/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,21 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch frontend development server",
"skipFiles": [
"<node_internals>/**"
],
"runtimeExecutable": "npm",
"runtimeArgs": [
"run"
],
"args": [
"dev"
],
"cwd": "${workspaceFolder}",
"envFile": "${workspaceFolder}/.env",
"outputCapture": "std",
"internalConsoleOptions": "openOnSessionStart"
}
]
}
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch frontend development server",
"skipFiles": ["<node_internals>/**"],
"runtimeExecutable": "npm",
"runtimeArgs": ["run"],
"args": ["dev"],
"cwd": "${workspaceFolder}",
"envFile": "${workspaceFolder}/.env",
"outputCapture": "std",
"internalConsoleOptions": "openOnSessionStart"
}
]
}
12 changes: 3 additions & 9 deletions frontend/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"prettier.documentSelectors": [
"**/*.svelte"
],
"prettier.documentSelectors": ["**/*.svelte"],
"tailwindCSS.classAttributes": [
"class",
"accent",
Expand Down Expand Up @@ -99,9 +97,5 @@
"[svelte]": {
"editor.defaultFormatter": "svelte.svelte-vscode"
},
"eslint.validate": [
"javascript",
"typescript",
"svelte"
]
}
"eslint.validate": ["javascript", "typescript", "svelte"]
}
136 changes: 68 additions & 68 deletions frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,70 +1,70 @@
{
"name": "frontend",
"version": "0.3.0",
"private": true,
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"sync": "svelte-kit sync",
"test": "playwright test",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"test:unit": "vitest",
"lint": "prettier --plugin-search-dir . --check . && eslint .",
"format": "prettier --plugin-search-dir . --write ."
},
"devDependencies": {
"@floating-ui/dom": "^1.6.3",
"@rollup/plugin-json": "^6.1.0",
"@skeletonlabs/skeleton": "^2.8.0",
"@skeletonlabs/tw-plugin": "0.3.1",
"@sveltejs/adapter-auto": "^3.1.1",
"@sveltejs/kit": "^2.5.0",
"@sveltejs/vite-plugin-svelte": "^3.0.2",
"@tailwindcss/forms": "0.5.7",
"@tailwindcss/typography": "0.5.10",
"@types/js-yaml": "^4.0.9",
"@types/node": "20.11.19",
"@typescript-eslint/eslint-plugin": "^6.15.0",
"@typescript-eslint/parser": "^6.15.0",
"autoprefixer": "10.4.17",
"eslint": "^8.56.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-airbnb-typescript": "^17.1.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-simple-import-sort": "^12.0.0",
"eslint-plugin-svelte": "^2.35.1",
"eslint-plugin-unicorn": "^51.0.1",
"postcss": "^8.4.35",
"prettier": "^3.2.5",
"prettier-plugin-svelte": "^3.2.1",
"svelte": "^4.2.11",
"svelte-check": "^3.6.4",
"tailwindcss": "^3.4.1",
"tslib": "^2.6.2",
"typescript": "^5.3.3",
"vite": "^5.1.3",
"vite-plugin-tailwind-purgecss": "0.2.0"
},
"type": "module",
"dependencies": {
"@fontsource/ibm-plex-sans": "^5.0.18",
"babel-plugin-prismjs": "^2.1.0",
"date-fns": "^3.3.1",
"filesize": "^10.1.0",
"graphql-request": "^6.1.0",
"highlight.js": "^11.9.0",
"js-yaml": "^4.1.0",
"json-to-pretty-yaml": "^1.2.2",
"keycloak-js": "^23.0.6",
"mermaid": "^10.8.0",
"minio": "^7.1.3",
"plotly.js-dist": "^2.29.1",
"svelte-feather-icons": "^4.1.0",
"svelte-plotly.js": "^0.3.2",
"vitest": "^1.4.0"
}
"name": "frontend",
"version": "0.3.0",
"private": true,
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"sync": "svelte-kit sync",
"test": "playwright test",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"test:unit": "vitest",
"lint": "prettier --plugin-search-dir . --check . && eslint .",
"format": "prettier --plugin-search-dir . --write ."
},
"devDependencies": {
"@floating-ui/dom": "^1.6.3",
"@rollup/plugin-json": "^6.1.0",
"@skeletonlabs/skeleton": "^2.8.0",
"@skeletonlabs/tw-plugin": "0.3.1",
"@sveltejs/adapter-auto": "^3.1.1",
"@sveltejs/kit": "^2.5.0",
"@sveltejs/vite-plugin-svelte": "^3.0.2",
"@tailwindcss/forms": "0.5.7",
"@tailwindcss/typography": "0.5.10",
"@types/js-yaml": "^4.0.9",
"@types/node": "20.11.19",
"@typescript-eslint/eslint-plugin": "^6.15.0",
"@typescript-eslint/parser": "^6.15.0",
"autoprefixer": "10.4.17",
"eslint": "^8.56.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-airbnb-typescript": "^17.1.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-simple-import-sort": "^12.0.0",
"eslint-plugin-svelte": "^2.35.1",
"eslint-plugin-unicorn": "^51.0.1",
"postcss": "^8.4.35",
"prettier": "^3.2.5",
"prettier-plugin-svelte": "^3.2.1",
"svelte": "^4.2.11",
"svelte-check": "^3.6.4",
"tailwindcss": "^3.4.1",
"tslib": "^2.6.2",
"typescript": "^5.3.3",
"vite": "^5.1.3",
"vite-plugin-tailwind-purgecss": "0.2.0"
},
"type": "module",
"dependencies": {
"@fontsource/ibm-plex-sans": "^5.0.18",
"babel-plugin-prismjs": "^2.1.0",
"date-fns": "^3.3.1",
"filesize": "^10.1.0",
"graphql-request": "^6.1.0",
"highlight.js": "^11.9.0",
"js-yaml": "^4.1.0",
"json-to-pretty-yaml": "^1.2.2",
"keycloak-js": "^23.0.6",
"mermaid": "^10.8.0",
"minio": "^7.1.3",
"plotly.js-dist": "^2.29.1",
"svelte-feather-icons": "^4.1.0",
"svelte-plotly.js": "^0.3.2",
"vitest": "^1.4.0"
}
}
2 changes: 1 addition & 1 deletion frontend/src/app.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en" class="dark">
<head>
<meta charset="utf-8" />
Expand Down
15 changes: 7 additions & 8 deletions frontend/src/lib/formatBytes.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@

// Helper function to format file size in a human-readable format
export function formatBytes(bytes: number, decimals: number = 2) {
if (bytes === 0) return '0 Bytes';
if (bytes === 0) return '0 Bytes';

const k = 1024;
const dm = decimals < 0 ? 0 : decimals;
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
const k = 1024;
const dm = decimals < 0 ? 0 : decimals;
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];

const i = Math.floor(Math.log(bytes) / Math.log(k));
const i = Math.floor(Math.log(bytes) / Math.log(k));

return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
}
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
}
15 changes: 7 additions & 8 deletions frontend/src/lib/modules/Alert.svelte
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<script lang="ts">
import { AlertTriangleIcon } from 'svelte-feather-icons';
export let visibleAlert = false;
export let alertTitle = 'Alert!';
export let alertMessage = 'Alert!';
export let alertVariant: string = 'variant-ghost-surface';
import { AlertTriangleIcon } from 'svelte-feather-icons';
export let visibleAlert = false;
export let alertTitle = 'Alert!';
export let alertMessage = 'Alert!';
export let alertVariant: string = 'variant-ghost-surface';
</script>

{#if visibleAlert}
<div class="flex w-full content-center p-10">
<div class="flex w-full content-center p-10">
<aside class="alert {alertVariant} w-full">
<div class="flex">
<div class="row-span-2">
Expand Down Expand Up @@ -37,4 +36,4 @@
</div>
</aside>
</div>
{/if}
{/if}
Loading

0 comments on commit 2ffe2cd

Please sign in to comment.