forked from extern/fediwall
Fixed bugs found by eslint
This commit is contained in:
parent
cee770d5a4
commit
181cc64a07
14
.eslintrc.cjs
Normal file
14
.eslintrc.cjs
Normal file
@ -0,0 +1,14 @@
|
||||
/* eslint-env node */
|
||||
require("@rushstack/eslint-patch/modern-module-resolution");
|
||||
|
||||
module.exports = {
|
||||
root: true,
|
||||
"extends": [
|
||||
"plugin:vue/vue3-essential",
|
||||
"eslint:recommended",
|
||||
"@vue/eslint-config-typescript",
|
||||
],
|
||||
parserOptions: {
|
||||
ecmaVersion: "latest"
|
||||
}
|
||||
};
|
3288
package-lock.json
generated
3288
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -14,7 +14,8 @@
|
||||
"dev": "vite",
|
||||
"preview": "vite preview",
|
||||
"build": "vite build",
|
||||
"check": "vue-tsc --noEmit -p tsconfig.app.json --composite false"
|
||||
"check": "vue-tsc --noEmit -p tsconfig.app.json --composite false",
|
||||
"lint": "eslint ./src --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"
|
||||
},
|
||||
"dependencies": {
|
||||
"@vueuse/core": "^10.2.1",
|
||||
@ -25,11 +26,17 @@
|
||||
"vue-masonry": "^0.16.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rushstack/eslint-patch": "^1.2.0",
|
||||
"@tsconfig/node18": "^2.0.1",
|
||||
"@types/node": "^18.16.17",
|
||||
"@typescript-eslint/eslint-plugin": "^6.2.0",
|
||||
"@typescript-eslint/parser": "^6.2.0",
|
||||
"@vitejs/plugin-legacy": "^4.1.0",
|
||||
"@vitejs/plugin-vue": "^4.2.3",
|
||||
"@vue/tsconfig": "^0.4.0",
|
||||
"@vue/eslint-config-typescript": "^11.0.3",
|
||||
"eslint": "^8.45.0",
|
||||
"eslint-plugin-vue": "^9.15.1",
|
||||
"git-describe": "^4.1.1",
|
||||
"typescript": "~5.0.4",
|
||||
"vite": "^4.3.9",
|
||||
|
@ -175,12 +175,6 @@ const toggleTheme = () => {
|
||||
config.value.theme = actualTheme.value === "dark" ? "light" : "dark"
|
||||
}
|
||||
|
||||
const aboutLink = computed(() => {
|
||||
if (config.value?.servers.length)
|
||||
return `https://${config.value.servers[0]}/about`
|
||||
return "#"
|
||||
})
|
||||
|
||||
const privacyLink = computed(() => {
|
||||
if (config.value?.servers.length)
|
||||
return `https://${config.value.servers[0]}/privacy-policy`
|
||||
@ -204,7 +198,7 @@ const privacyLink = computed(() => {
|
||||
<div v-if="filteredPosts.length === 0 && updateInProgress">Loading first posts ...</div>
|
||||
<div v-else-if="filteredPosts.length === 0">Nothing there yet ...</div>
|
||||
<div v-else v-masonry transition-duration="1s" item-selector=".wall-item" percent-position="true" id="wall">
|
||||
<Card v-masonry-tile class="wall-item secret-hover" v-for="(post, index) in filteredPosts" :key="post.id"
|
||||
<Card v-masonry-tile class="wall-item secret-hover" v-for="post in filteredPosts" :key="post.id"
|
||||
:post="post">
|
||||
<template v-slot:topleft>
|
||||
<div class="dropdown secret">
|
||||
|
@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { type Config } from '@/types';
|
||||
|
||||
const props = defineProps<{
|
||||
defineProps<{
|
||||
config: Config
|
||||
}>()
|
||||
|
||||
@ -21,7 +21,7 @@ const props = defineProps<{
|
||||
<template v-if="config.accounts.length && config?.tags.length"> and </template>
|
||||
<template v-if="config.accounts.length">
|
||||
posts or boosts by
|
||||
<template v-for="(acc, index) in config.accounts" :key="t">
|
||||
<template v-for="(acc, index) in config.accounts" :key="acc">
|
||||
<code>@{{ acc }}</code>
|
||||
<template v-if="index < config.accounts.length - 2">, </template>
|
||||
<template v-else-if="index == config.accounts.length - 2"> or </template>
|
||||
|
@ -5,7 +5,7 @@ import { type Config } from '@/types';
|
||||
|
||||
|
||||
|
||||
var siteConfig: Config | null = null;
|
||||
let siteConfig: Config | null = null;
|
||||
|
||||
const themes = ["dark", "light", "auto"];
|
||||
const boolYes = ["", "y", "yes", "true"];
|
||||
@ -269,7 +269,7 @@ export function sanatizeConfig(config: any): Config {
|
||||
}
|
||||
|
||||
async function loadSideConfig() {
|
||||
var config;
|
||||
let config;
|
||||
|
||||
try {
|
||||
config = await (await fetch(siteConfigUrl)).json() || {};
|
||||
|
@ -109,7 +109,7 @@ const accountCache: Record<string, MastodonAccount | null> = {}
|
||||
async function getLocalUser(user: string, domain: string): Promise<any> {
|
||||
const key = `${user}@${domain}`
|
||||
|
||||
if (!accountCache.hasOwnProperty(key)) {
|
||||
if (!Object.hasOwnProperty.call(accountCache, key)) {
|
||||
try {
|
||||
accountCache[key] = (await fetchJson(domain, "v1/accounts/lookup", { acct: user })) as MastodonAccount
|
||||
} catch (e) {
|
||||
@ -131,10 +131,10 @@ async function fetchJson(domain: string, path: string, query?: Record<string, an
|
||||
const pairs = Object.entries(query).map(([key, value]) => [key, value.toString()])
|
||||
url += "?" + new URLSearchParams(pairs).toString()
|
||||
}
|
||||
var rs = await fetch(url)
|
||||
let rs = await fetch(url)
|
||||
|
||||
// Auto-retry rate limit errors
|
||||
var errCount = 0
|
||||
let errCount = 0
|
||||
while (!rs.ok) {
|
||||
if (errCount++ > 3)
|
||||
break // Do not retry anymore
|
||||
@ -206,12 +206,12 @@ const filterStatus = (cfg: Config, status: MastodonStatus) => {
|
||||
* Convert a mastdon status object to a Post.
|
||||
*/
|
||||
const statusToWallPost = (status: MastodonStatus): Post => {
|
||||
let date = status.created_at
|
||||
const date = status.created_at
|
||||
|
||||
if (status.reblog)
|
||||
status = status.reblog
|
||||
|
||||
var media;
|
||||
let media;
|
||||
const image = status.media_attachments?.find((m: any) => m.type == "image")
|
||||
if (image)
|
||||
media = image.url
|
||||
|
@ -1,36 +1,36 @@
|
||||
import { fileURLToPath, URL } from 'node:url'
|
||||
import { fileURLToPath, URL } from "node:url";
|
||||
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import viteCompression from 'vite-plugin-compression';
|
||||
import { gitDescribeSync } from 'git-describe';
|
||||
import viteLegacy from '@vitejs/plugin-legacy'
|
||||
import { defineConfig } from "vite";
|
||||
import vue from "@vitejs/plugin-vue";
|
||||
import viteCompression from "vite-plugin-compression";
|
||||
import { gitDescribeSync } from "git-describe";
|
||||
import viteLegacy from "@vitejs/plugin-legacy";
|
||||
|
||||
var version;
|
||||
let version;
|
||||
|
||||
try {
|
||||
var gitInfo = gitDescribeSync();
|
||||
if(gitInfo.tag) {
|
||||
version = `${gitInfo.tag}`;
|
||||
if (gitInfo.distance)
|
||||
version += `-${gitInfo.distance}+${gitInfo.hash}`
|
||||
}
|
||||
} catch { }
|
||||
const gitInfo = gitDescribeSync();
|
||||
if (gitInfo.tag) {
|
||||
version = `${gitInfo.tag}`;
|
||||
if (gitInfo.distance)
|
||||
version += `-${gitInfo.distance}+${gitInfo.hash}`;
|
||||
}
|
||||
} catch { ; }
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
base: "./",
|
||||
define: {
|
||||
__VERSION__: JSON.stringify(version)
|
||||
},
|
||||
plugins: [
|
||||
vue(),
|
||||
viteCompression(),
|
||||
viteLegacy(),
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url))
|
||||
base: "./",
|
||||
define: {
|
||||
__VERSION__: JSON.stringify(version)
|
||||
},
|
||||
plugins: [
|
||||
vue(),
|
||||
viteCompression(),
|
||||
viteLegacy(),
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
"@": fileURLToPath(new URL("./src", import.meta.url))
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user