From da16f24577443836dffdefc071b5a8ccef135751 Mon Sep 17 00:00:00 2001 From: ccbikai Date: Tue, 24 Dec 2024 21:10:36 +0800 Subject: [PATCH] style: eslint --- .vscode/settings.json | 50 ++++++++++++++- components/dashboard/Counters.vue | 2 +- components/dashboard/links/Editor.vue | 10 +-- components/dashboard/links/Index.vue | 2 +- components/dashboard/links/Link.vue | 4 +- components/dashboard/links/Search.vue | 2 +- components/dashboard/metrics/Locations.vue | 2 +- components/dashboard/metrics/name/Icon.vue | 22 +++---- components/home/Hero.vue | 2 +- components/home/Twitter.vue | 2 +- components/login/index.vue | 2 +- nuxt.config.ts | 72 +++++++++++----------- schemas/link.ts | 2 +- server/api/link/ai.get.ts | 2 +- server/api/stats/metrics.get.ts | 2 +- server/api/stats/views.get.ts | 2 +- server/middleware/1.redirect.ts | 2 +- server/utils/access-log.ts | 6 +- server/utils/query-filter.ts | 4 +- utils/color.ts | 2 +- 20 files changed, 120 insertions(+), 74 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 68d55ed..e3dd158 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,50 @@ { - // Enable ESlint flat config support - "eslint.useFlatConfig": true + // Disable the default formatter, use eslint instead + "prettier.enable": false, + "editor.formatOnSave": false, + + // Auto fix + "editor.codeActionsOnSave": { + "source.fixAll.eslint": "explicit", + "source.organizeImports": "never" + }, + + // Silent the stylistic rules in you IDE, but still auto fix them + "eslint.rules.customizations": [ + { "rule": "style/*", "severity": "off", "fixable": true }, + { "rule": "format/*", "severity": "off", "fixable": true }, + { "rule": "*-indent", "severity": "off", "fixable": true }, + { "rule": "*-spacing", "severity": "off", "fixable": true }, + { "rule": "*-spaces", "severity": "off", "fixable": true }, + { "rule": "*-order", "severity": "off", "fixable": true }, + { "rule": "*-dangle", "severity": "off", "fixable": true }, + { "rule": "*-newline", "severity": "off", "fixable": true }, + { "rule": "*quotes", "severity": "off", "fixable": true }, + { "rule": "*semi", "severity": "off", "fixable": true } + ], + + // Enable eslint for all supported languages + "eslint.validate": [ + "javascript", + "javascriptreact", + "typescript", + "typescriptreact", + "vue", + "html", + "markdown", + "json", + "jsonc", + "yaml", + "toml", + "xml", + "gql", + "graphql", + "astro", + "svelte", + "css", + "less", + "scss", + "pcss", + "postcss" + ] } diff --git a/components/dashboard/Counters.vue b/components/dashboard/Counters.vue index e0b4a1e..528de8e 100644 --- a/components/dashboard/Counters.vue +++ b/components/dashboard/Counters.vue @@ -1,6 +1,6 @@ diff --git a/components/home/Twitter.vue b/components/home/Twitter.vue index c93e7fc..3e2d91b 100644 --- a/components/home/Twitter.vue +++ b/components/home/Twitter.vue @@ -1,6 +1,6 @@ diff --git a/components/login/index.vue b/components/login/index.vue index ef590e2..e8c2e3e 100644 --- a/components/login/index.vue +++ b/components/login/index.vue @@ -1,7 +1,7 @@