diff --git a/.eslintrc.cjs b/.eslintrc.cjs
deleted file mode 100644
index e5f803c..0000000
--- a/.eslintrc.cjs
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2023-2024 ThrRip, XMing (洺知-故犯)
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at https://mozilla.org/MPL/2.0/.
- */
-
-module.exports = {
- root: true,
- env: {
- browser: true,
- node: true
- },
- extends: [
- 'standard',
- '@nuxtjs/eslint-config-typescript',
- 'plugin:nuxt/recommended'
- ],
- rules: {
- 'indent': ['error', 2, { ignoredNodes: ['IfStatement[alternate.type="IfStatement"]'], SwitchCase: 1 }],
- 'operator-linebreak': ['error', 'after'],
- 'quote-props': ['error', 'consistent']
- }
-}
diff --git a/.idea/dictionaries/thrrip.xml b/.idea/dictionaries/thrrip.xml
index 2530980..ba121a1 100644
--- a/.idea/dictionaries/thrrip.xml
+++ b/.idea/dictionaries/thrrip.xml
@@ -9,6 +9,7 @@
getline
mktemp
nuxtjs
+ singleline
webmanifest
zstd
diff --git a/eslint.config.js b/eslint.config.js
new file mode 100644
index 0000000..78409ff
--- /dev/null
+++ b/eslint.config.js
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2024 ThrRip, XMing (洺知-故犯)
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+
+import withNuxt from './.nuxt/eslint.config.mjs'
+
+export default withNuxt(
+ {
+ files: ['eslint.config.js']
+ },
+ {
+ rules: {
+ '@typescript-eslint/ban-ts-comment': ['error', {
+ 'ts-expect-error': false,
+ 'ts-nocheck': false
+ }],
+ '@typescript-eslint/no-dynamic-delete': 'off',
+ '@stylistic/arrow-parens': ['error', 'as-needed', { requireForBlockBody: false }],
+ '@stylistic/comma-dangle': ['error', 'never'],
+ '@stylistic/indent': ['error', 2, {
+ ignoredNodes: ['IfStatement[alternate.type="IfStatement"]'],
+ SwitchCase: 1
+ }],
+ '@stylistic/indent-binary-ops': 'off',
+ '@stylistic/max-statements-per-line': ['error', { max: 2 }],
+ '@stylistic/operator-linebreak': ['error', 'after'],
+ '@stylistic/space-before-function-paren': ['error', 'always'],
+ 'vue/comma-dangle': ['error', 'never'],
+ 'vue/max-attributes-per-line': ['warn', { singleline: 5 }],
+ 'vue/operator-linebreak': ['error', 'after']
+ }
+ },
+ {
+ files: ['packages/*/pages/**/*.vue'],
+ rules: { 'vue/multi-word-component-names': 'off' }
+ }
+)
diff --git a/nuxt.config.ts b/nuxt.config.ts
new file mode 100644
index 0000000..f570dc9
--- /dev/null
+++ b/nuxt.config.ts
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2024 ThrRip, XMing (洺知-故犯)
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+
+export default defineNuxtConfig({
+ modules: [
+ '@nuxt/eslint'
+ ],
+
+ eslint: {
+ config: {
+ stylistic: true
+ }
+ }
+})
diff --git a/packages/admin/app.vue b/packages/admin/app.vue
index c9dc41c..ad4379d 100644
--- a/packages/admin/app.vue
+++ b/packages/admin/app.vue
@@ -99,9 +99,9 @@
@@ -155,9 +155,9 @@ backendClient.setEndpoint(useAppConfig().backendBase)
.setProject(useAppConfig().backendProjectId)
const backendAccount = new Account(backendClient)
-const backendLoggedIn = ref(false)
-const backendLoggedInChecking = ref(true)
-if (process.client) {
+const backendLoggedIn = ref(false)
+const backendLoggedInChecking = ref(true)
+if (import.meta.client) {
backendAccount.get()
.then(
() => {
@@ -208,19 +208,20 @@ function backendLogout () {
}
// View
-const viewShowLoginModal = ref(true)
+const viewShowLoginModal = ref(true)
-const viewShowFullNavigationBar = ref(false)
-const viewShowFullNavigationBarRealState = ref(false)
+const viewShowFullNavigationBar = ref(false)
+const viewShowFullNavigationBarRealState = ref(false)
const viewFullNavigationBarToggles = ref(0)
-const viewShowPageContent = ref(true)
+const viewShowPageContent = ref(true)
function viewToggleFullNavigationBar (show?: boolean) {
if (show === undefined) {
viewShowFullNavigationBar.value = !viewShowFullNavigationBar.value
viewFullNavigationBarToggles.value++
- } else
+ }
+ else
if (viewShowFullNavigationBar.value !== show) {
viewShowFullNavigationBar.value = show
viewFullNavigationBarToggles.value++
@@ -230,7 +231,8 @@ function viewToggleFullNavigationBar (show?: boolean) {
}, 300)
if (viewShowFullNavigationBar.value) {
viewShowPageContent.value = !viewShowFullNavigationBar.value
- } else {
+ }
+ else {
setTimeout(() => { viewShowPageContent.value = !viewShowFullNavigationBar.value }, 150)
}
}
diff --git a/packages/admin/components/playlist/ChangesList.vue b/packages/admin/components/playlist/ChangesList.vue
index 00085ec..73c594f 100644
--- a/packages/admin/components/playlist/ChangesList.vue
+++ b/packages/admin/components/playlist/ChangesList.vue
@@ -214,9 +214,9 @@
'请联系您的技术支持人员以获取帮助,或点击此图标以重新选择此项目,并再次尝试发布改动。' :
''"
class="group grid portrait:row-span-2 place-items-center pl-2.5 portrait:pl-2.5 portrait:pr-1 py-2.5 h-full"
- :class="[ !getPublishingStateById(song.$id) ? 'cursor-pointer' :
+ :class="[!getPublishingStateById(song.$id) ? 'cursor-pointer' :
getPublishingStateById(song.$id)?.state === 'failed' ? 'grid-areas-stack cursor-pointer' :
- 'grid-areas-stack' ]"
+ 'grid-areas-stack']"
>
()
const selectableIds = computed>(() => {
- // @ts-ignore
+ // @ts-expect-error
return props.dataChanges.map(song => song.$id)
.filter(id => getPublishingStateById(id)?.state !== 'processing' && getPublishingStateById(id)?.state !== 'succeeded')
})
diff --git a/packages/admin/components/playlist/MainList.vue b/packages/admin/components/playlist/MainList.vue
index fac5be3..ccbc769 100644
--- a/packages/admin/components/playlist/MainList.vue
+++ b/packages/admin/components/playlist/MainList.vue
@@ -366,7 +366,8 @@ function scrollList (position: 'top' | 'bottom') {
top: 0,
behavior: 'smooth'
}))
- } else {
+ }
+ else {
nextTick(() => listArea.value?.scroll({
top: listArea.value?.scrollHeight,
behavior: 'smooth'
@@ -382,7 +383,6 @@ interface ModifyTarget {
field: 'name' | 'artist' | 'payment_amount' | 'language'
}
const modifyingTarget = ref<{
- // eslint-disable-next-line no-use-before-define
[P in keyof ModifyTarget]: ModifyTarget[P] | null
}>({
id: null,
diff --git a/packages/admin/ecosystem.config.js b/packages/admin/ecosystem.config.js
index 35a62db..e2053d1 100644
--- a/packages/admin/ecosystem.config.js
+++ b/packages/admin/ecosystem.config.js
@@ -15,9 +15,9 @@ module.exports = {
port: 12321,
max_memory_restart: '200M',
env: {
- 'NITRO_PORT': 12321,
- 'NUXT_APP_SECURE_CONTEXT': true,
- 'NUXT_BACKEND_API_KEY': ''
+ NITRO_PORT: 12321,
+ NUXT_APP_SECURE_CONTEXT: true,
+ NUXT_BACKEND_API_KEY: ''
}
}
]
diff --git a/packages/admin/middleware/entry.global.ts b/packages/admin/middleware/entry.global.ts
index da13936..a044ae7 100644
--- a/packages/admin/middleware/entry.global.ts
+++ b/packages/admin/middleware/entry.global.ts
@@ -6,8 +6,8 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
-export default defineNuxtRouteMiddleware(async (to) => {
- if (process.client) { return }
+export default defineNuxtRouteMiddleware(async to => {
+ if (import.meta.client) { return }
function navigateToHome () {
return navigateTo(useAppConfig().appHomeBase, { external: true })
@@ -19,6 +19,7 @@ export default defineNuxtRouteMiddleware(async (to) => {
httpOnly: true,
path: useAppConfig().appAdminBasePath,
sameSite: 'strict',
+ // @ts-expect-error
secure: useRuntimeConfig().appSecureContext
})
const entryToken = entryTokenQuery ?? entryTokenCookie.value
@@ -29,7 +30,7 @@ export default defineNuxtRouteMiddleware(async (to) => {
const backendDatabases = new Databases(backendClient)
backendClient.setEndpoint(useAppConfig().backendBase)
.setProject(useAppConfig().backendProjectId)
- .setKey(useRuntimeConfig().backendApiKey)
+ .setKey(useRuntimeConfig().backendApiKey as string)
const entryTokenMatches = (await backendDatabases.listDocuments(
'admin',
@@ -41,7 +42,8 @@ export default defineNuxtRouteMiddleware(async (to) => {
)).total
if (entryTokenMatches) {
entryTokenCookie.value = String(entryToken)
- } else {
+ }
+ else {
return navigateToHome()
}
})
diff --git a/packages/admin/nuxt.config.ts b/packages/admin/nuxt.config.ts
index b37ea73..51bec01 100644
--- a/packages/admin/nuxt.config.ts
+++ b/packages/admin/nuxt.config.ts
@@ -31,21 +31,23 @@ export default defineNuxtConfig({
}
},
- build: {
- transpile: ['@fortawesome/vue-fontawesome']
- },
-
css: [
'@/../../assets/css/main.css',
'@fortawesome/fontawesome-svg-core/styles.css'
],
+ build: {
+ transpile: ['@fortawesome/vue-fontawesome']
+ },
+
devServer: {
host: '0.0.0.0',
port: 3001
},
- devtools: false,
+ devtools: {
+ enabled: false
+ },
nitro: {
preset: 'bun'
@@ -53,8 +55,8 @@ export default defineNuxtConfig({
postcss: {
plugins: {
- 'tailwindcss': {},
- 'autoprefixer': {}
+ tailwindcss: {},
+ autoprefixer: {}
}
},
diff --git a/packages/admin/pages/playlist.vue b/packages/admin/pages/playlist.vue
index 3a74aa0..f6fe0e8 100644
--- a/packages/admin/pages/playlist.vue
+++ b/packages/admin/pages/playlist.vue
@@ -42,8 +42,8 @@
diff --git a/packages/home/ecosystem.config.js b/packages/home/ecosystem.config.js
index 14ba4ca..eacb620 100644
--- a/packages/home/ecosystem.config.js
+++ b/packages/home/ecosystem.config.js
@@ -15,7 +15,7 @@ module.exports = {
port: 12320,
max_memory_restart: '200M',
env: {
- 'NITRO_PORT': 12320
+ NITRO_PORT: 12320
}
}
]
diff --git a/packages/home/nuxt.config.ts b/packages/home/nuxt.config.ts
index e2e5016..0eba7a2 100644
--- a/packages/home/nuxt.config.ts
+++ b/packages/home/nuxt.config.ts
@@ -30,20 +30,22 @@ export default defineNuxtConfig({
}
},
- build: {
- transpile: ['@fortawesome/vue-fontawesome']
- },
-
css: [
'@/../../assets/css/main.css',
'@fortawesome/fontawesome-svg-core/styles.css'
],
+ build: {
+ transpile: ['@fortawesome/vue-fontawesome']
+ },
+
devServer: {
host: '0.0.0.0'
},
- devtools: false,
+ devtools: {
+ enabled: false
+ },
nitro: {
preset: 'bun'
@@ -51,8 +53,8 @@ export default defineNuxtConfig({
postcss: {
plugins: {
- 'tailwindcss': {},
- 'autoprefixer': {}
+ tailwindcss: {},
+ autoprefixer: {}
}
}
})
diff --git a/packages/home/plugins/fontawesome.ts b/packages/home/plugins/fontawesome.ts
index 704ccac..28aa74c 100644
--- a/packages/home/plugins/fontawesome.ts
+++ b/packages/home/plugins/fontawesome.ts
@@ -7,7 +7,6 @@
*/
import { library, config } from '@fortawesome/fontawesome-svg-core'
-// eslint-disable-next-line import/named
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
import {
@@ -44,6 +43,6 @@ library.add(
faDice
)
-export default defineNuxtPlugin((nuxtApp) => {
+export default defineNuxtPlugin(nuxtApp => {
nuxtApp.vueApp.component('font-awesome-icon', FontAwesomeIcon)
})