From 8b6b6e0575e3edeb246154d19b1131e8c70e5224 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 16 Apr 2024 00:14:12 +0200 Subject: [PATCH] chore: migrate to eslint v9 (#834) --- .eslintignore | 3 - .eslintrc.cjs | 14 - .vscode/settings.json | 3 + docs/app.config.ts | 62 +- docs/app.vue | 17 +- docs/components/AdsUIPro.vue | 142 ++- docs/components/AppHeader.vue | 13 +- docs/components/OgImage/OgImageDocs.vue | 163 +++- docs/components/{Logo.vue => TheLogo.vue} | 0 docs/components/content/Sandbox.vue | 17 +- docs/error.vue | 13 +- docs/nuxt.config.ts | 16 +- docs/nuxt.schema.ts | 76 +- docs/pages/[...slug].vue | 50 +- docs/pages/index.vue | 19 +- docs/tailwind.config.ts | 12 +- eslint.config.js | 34 + nuxt2-playground/layouts/default.vue | 8 +- nuxt2-playground/nuxt.config.js | 4 +- nuxt2-playground/tailwind.config.js | 2 +- package.json | 4 +- playground/modules/resolved.ts | 24 +- playground/modules/template.js | 2 +- playground/nuxt.config.ts | 22 +- playground/tailwind.config.ts | 12 +- playground/theme/nuxt.config.ts | 2 +- playground/theme/tailwind.config.cjs | 8 +- pnpm-lock.yaml | 834 +++++++++++++++--- src/context.ts | 45 +- src/expose.ts | 31 +- src/logger.ts | 3 +- src/module.ts | 56 +- src/resolvers.ts | 13 +- src/runtime/merger.mjs | 5 +- src/types.ts | 54 +- src/viewer.ts | 14 +- test/basic.test.ts | 6 +- test/configs.test.ts | 15 +- test/fixtures/basic/alt-tailwind.config.js | 10 +- test/fixtures/basic/content-obj.config.ts | 8 +- .../basic/malformed-tailwind.config.js | 4 +- test/fixtures/basic/modules/cjs-config.ts | 6 +- test/fixtures/basic/nuxt.config.ts | 8 +- .../basic/override-tailwind.config.js | 10 +- test/fixtures/basic/tailwind.config.js | 10 +- test/fixtures/basic/ts-tailwind.config.ts | 10 +- test/fixtures/nuxt2/nuxt.config.ts | 8 +- test/fixtures/nuxt2/pages/index.vue | 4 +- test/sink.test.ts | 6 +- test/utils.ts | 7 +- 50 files changed, 1378 insertions(+), 531 deletions(-) delete mode 100644 .eslintignore delete mode 100644 .eslintrc.cjs create mode 100644 .vscode/settings.json rename docs/components/{Logo.vue => TheLogo.vue} (100%) create mode 100644 eslint.config.js diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 6d6a6976..00000000 --- a/.eslintignore +++ /dev/null @@ -1,3 +0,0 @@ -dist -node_modules -test/fixtures/**/* diff --git a/.eslintrc.cjs b/.eslintrc.cjs deleted file mode 100644 index 65467f6c..00000000 --- a/.eslintrc.cjs +++ /dev/null @@ -1,14 +0,0 @@ -/** @type {import('eslint').ESLint.ConfigData} */ -module.exports = { - root: true, - extends: ["@nuxt/eslint-config"], - rules: { - semi: ['error', 'never'], - quotes: ['error', 'single'], - 'quote-props': ['error', 'as-needed'], - // Vue - 'vue/multi-word-component-names': 0, - 'vue/max-attributes-per-line': 'off', - 'vue/no-v-html': 0 - } -}; diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..e78d7ff8 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "eslint.experimental.useFlatConfig": true +} \ No newline at end of file diff --git a/docs/app.config.ts b/docs/app.config.ts index 92d976b8..842f1119 100644 --- a/docs/app.config.ts +++ b/docs/app.config.ts @@ -7,53 +7,53 @@ export default defineAppConfig({ footer: { bottom: { left: 'text-sm text-gray-500 dark:text-gray-400', - wrapper: 'border-t border-gray-200 dark:border-gray-800' - } - } + wrapper: 'border-t border-gray-200 dark:border-gray-800', + }, + }, }, header: { logo: { light: { - src: '' + src: '', }, dark: { - src: '' - } + src: '', + }, }, pkgVersion, search: true, colorMode: true, links: [{ - icon: 'i-simple-icons-github', - to: 'https://github.com/nuxt-modules/tailwindcss', - target: '_blank', - 'aria-label': 'Docs template on GitHub' - }] + 'icon': 'i-simple-icons-github', + 'to': 'https://github.com/nuxt-modules/tailwindcss', + 'target': '_blank', + 'aria-label': 'Docs template on GitHub', + }], }, footer: { credits: 'Copyright © 2023', colorMode: false, links: [{ - icon: 'i-simple-icons-nuxtdotjs', - to: 'https://nuxt.com', - target: '_blank', - 'aria-label': 'Nuxt Website' + 'icon': 'i-simple-icons-nuxtdotjs', + 'to': 'https://nuxt.com', + 'target': '_blank', + 'aria-label': 'Nuxt Website', }, { - icon: 'i-simple-icons-discord', - to: 'https://discord.com/invite/ps2h6QT', - target: '_blank', - 'aria-label': 'Nuxt Tailwind on Discord' + 'icon': 'i-simple-icons-discord', + 'to': 'https://discord.com/invite/ps2h6QT', + 'target': '_blank', + 'aria-label': 'Nuxt Tailwind on Discord', }, { - icon: 'i-simple-icons-x', - to: 'https://x.com/nuxt_js', - target: '_blank', - 'aria-label': 'Nuxt on X' + 'icon': 'i-simple-icons-x', + 'to': 'https://x.com/nuxt_js', + 'target': '_blank', + 'aria-label': 'Nuxt on X', }, { - icon: 'i-simple-icons-github', - to: 'https://github.com/nuxt-modules/tailwindcss', - target: '_blank', - 'aria-label': 'Nuxt Tailwind on GitHub' - }] + 'icon': 'i-simple-icons-github', + 'to': 'https://github.com/nuxt-modules/tailwindcss', + 'target': '_blank', + 'aria-label': 'Nuxt Tailwind on GitHub', + }], }, toc: { title: 'Table of Contents', @@ -75,7 +75,7 @@ export default defineAppConfig({ label: 'Tailwind CSS docs', to: 'https://tailwindcss.com', target: '_blank', - }] - } - } + }], + }, + }, }) diff --git a/docs/app.vue b/docs/app.vue index 8b99ad0d..81374bb7 100644 --- a/docs/app.vue +++ b/docs/app.vue @@ -4,24 +4,24 @@ import type { ParsedContent } from '@nuxt/content/dist/runtime/types' const { data: navigation } = await useAsyncData('navigation', () => fetchContentNavigation()) const { data: files } = useLazyFetch('/api/search.json', { default: () => [], - server: false + server: false, }) useHead({ meta: [ - { name: 'viewport', content: 'width=device-width, initial-scale=1' } + { name: 'viewport', content: 'width=device-width, initial-scale=1' }, ], link: [ - { rel: 'icon', href: '/favicon.ico' } + { rel: 'icon', href: '/favicon.ico' }, ], htmlAttrs: { - lang: 'en' - } + lang: 'en', + }, }) useSeoMeta({ ogSiteName: 'Nuxt TailwindCSS', - twitterCard: 'summary_large_image' + twitterCard: 'summary_large_image', }) provide('navigation', navigation) @@ -39,7 +39,10 @@ provide('navigation', navigation) - + diff --git a/docs/components/AdsUIPro.vue b/docs/components/AdsUIPro.vue index ecd4df87..9a8e7649 100644 --- a/docs/components/AdsUIPro.vue +++ b/docs/components/AdsUIPro.vue @@ -1,5 +1,9 @@