From 78dd478272deefed2495d5fca2905be49c7cdf0e Mon Sep 17 00:00:00 2001 From: viandwi24 Date: Thu, 13 Apr 2023 01:30:53 +0700 Subject: [PATCH] chore: eslint & prettier --- .eslintignore | 7 + .eslintrc | 12 + .prettierrc | 4 + README.md | 2 +- app.config.ts | 10 +- app/app.config.ts | 8 +- app/nuxt.config.ts | 2 +- app/pages/setting.vue | 259 +++--- components/awesome/Welcome.vue | 26 +- components/layouts/Page/Content.vue | 5 +- components/layouts/Page/Footer.vue | 9 +- components/layouts/Page/Navbar.vue | 43 +- examples/starter/app.config.ts | 4 +- modules/awesome.ts | 8 +- nuxt.config.ts | 23 +- nuxt.schema.ts | 12 +- package.json | 8 + pnpm-lock.yaml | 1222 ++++++++++++++++++++++++++- tailwind.config.ts | 2 +- 19 files changed, 1480 insertions(+), 186 deletions(-) create mode 100644 .eslintignore create mode 100644 .eslintrc create mode 100644 .prettierrc diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..0a3df7a --- /dev/null +++ b/.eslintignore @@ -0,0 +1,7 @@ +node_modules +dist +.nuxt +.output +coverage +components.d.ts +nuxt.d.ts diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..8c12650 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,12 @@ +{ + "root": true, + "extends": [ + "@nuxtjs/eslint-config-typescript", + "plugin:prettier/recommended" + ], + "rules": { + "vue/multi-word-component-names": "off", + "vue/no-multiple-template-root": "off", + "@typescript-eslint/no-unused-vars": "off" + } +} diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..b2095be --- /dev/null +++ b/.prettierrc @@ -0,0 +1,4 @@ +{ + "semi": false, + "singleQuote": true +} diff --git a/README.md b/README.md index 19283ae..bf06403 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,6 @@ a Nuxt 3 starter template with a lot of useful features, integrated with Tailwin - [x] Adding Pinia - [x] auto import "defineStore" as "definePiniaStore" - [x] auto import folder "stores" +- [x] Eslint & Prettier - [ ] 🌙 Switch Theme (light, dark, system, realtime) - [ ] 🇮🇩 Language Switcher -- [ ] Eslint & Prettier diff --git a/app.config.ts b/app.config.ts index 497070b..9a4c1b2 100644 --- a/app.config.ts +++ b/app.config.ts @@ -44,7 +44,7 @@ export interface NuxtAwesomeAppConfig { /** author github link */ github?: string /** author medium link */ - medium?: string, + medium?: string /** author website link */ website?: string } @@ -63,13 +63,13 @@ export default defineAppConfig({ project: { links: { github: 'https://github.com/viandwi24/nuxt3-awesome-starter', - } + }, }, layout: { page: { navbar: { - menus: [] - } + menus: [], + }, }, footer: { year: 2022, @@ -83,5 +83,5 @@ export default defineAppConfig({ website: 'https://viandwi24.site', }, }, - } as NuxtAwesomeAppConfig + } as NuxtAwesomeAppConfig, }) diff --git a/app/app.config.ts b/app/app.config.ts index c97c97e..e59af1e 100644 --- a/app/app.config.ts +++ b/app/app.config.ts @@ -4,7 +4,7 @@ export default defineAppConfig({ project: { links: { github: 'https://github.com/viandwi24/nuxt3-awesome-starter', - } + }, }, layout: { page: { @@ -14,8 +14,8 @@ export default defineAppConfig({ { type: 'link', title: 'Post', to: { name: 'post' } }, { type: 'link', title: 'Test', to: { name: 'test' } }, { type: 'button', title: 'Setting', to: { name: 'setting' } }, - ] - } + ], + }, }, footer: { year: 2022, @@ -29,5 +29,5 @@ export default defineAppConfig({ website: 'https://viandwi24.site', }, }, - } + }, }) diff --git a/app/nuxt.config.ts b/app/nuxt.config.ts index 443738e..feeca9b 100644 --- a/app/nuxt.config.ts +++ b/app/nuxt.config.ts @@ -3,5 +3,5 @@ export default defineNuxtConfig({ modules: [ // for debugging on development // '@nuxt/devtools' - ] + ], }) diff --git a/app/pages/setting.vue b/app/pages/setting.vue index 47c3bd1..7cd5085 100644 --- a/app/pages/setting.vue +++ b/app/pages/setting.vue @@ -39,10 +39,11 @@ const validate = async () => { const response = await fetch( `https://api.github.com/users/${username.value}` ) - if (response.status !== 200) + if (response.status !== 200) { throw new Error( `error when fetching username : ${response.statusText} (${response.status})` ) + } const data = (await response.json()) as { name: string id: string @@ -66,8 +67,15 @@ const validate = async () => { class="flex flex-col md:flex-row md:space-x-4" :vertical="screen.higherThan(Size.MEDIUM)" > - - + +