@dargmuesli/nuxt-vio 11.0.2 → 11.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,79 @@
1
+ // // TODO: add compat plugin when it supports flat config (https://github.com/amilajack/eslint-plugin-compat/issues/603)
2
+ // import { FlatCompat } from '@eslint/eslintrc'
3
+ import vueI18n from '@intlify/eslint-plugin-vue-i18n'
4
+ import prettier from 'eslint-plugin-prettier/recommended'
5
+ import eslintPluginYml from 'eslint-plugin-yml'
6
+ import globals from 'globals'
7
+ import jiti from 'jiti'
8
+
9
+ const moduleFileUrl = new URL(import.meta.url)
10
+ // const compat = new FlatCompat({
11
+ // baseDirectory: moduleFileUrl.pathname,
12
+ // })
13
+ const JITI = jiti(moduleFileUrl.pathname)
14
+ const POLYFILLS = JITI('../utils/constants.ts').POLYFILLS
15
+
16
+ export const VIO_ESLINT_CONFIG = [
17
+ ...vueI18n.configs['flat/recommended'],
18
+ // ...compat.extends('plugin:compat/recommended'),
19
+ ...eslintPluginYml.configs['flat/recommended'],
20
+ prettier, // must be last
21
+
22
+ // {
23
+ // files: ['server/**/*'],
24
+ // rules: {
25
+ // 'compat/compat': 'off',
26
+ // },
27
+ // },
28
+ {
29
+ languageOptions: {
30
+ globals: {
31
+ ...globals.node,
32
+ },
33
+ },
34
+ rules: {
35
+ '@intlify/vue-i18n/no-missing-keys': 'error',
36
+ '@intlify/vue-i18n/no-raw-text': 'error',
37
+ '@intlify/vue-i18n/no-deprecated-i18n-component': 'error', // TODO: do not specify below rules manually, but have them included in `recommended` https://github.com/intlify/eslint-plugin-vue-i18n/issues/275
38
+ '@intlify/vue-i18n/no-deprecated-i18n-place-attr': 'error',
39
+ '@intlify/vue-i18n/no-deprecated-i18n-places-prop': 'error',
40
+ '@intlify/vue-i18n/no-i18n-t-path-prop': 'error',
41
+ '@intlify/vue-i18n/valid-message-syntax': 'error',
42
+ '@intlify/vue-i18n/key-format-style': 'error',
43
+ '@intlify/vue-i18n/no-duplicate-keys-in-locale': 'error',
44
+ '@intlify/vue-i18n/no-dynamic-keys': 'error',
45
+ '@intlify/vue-i18n/no-missing-keys-in-other-locales': 'error',
46
+ '@intlify/vue-i18n/no-unknown-locale': 'error',
47
+ '@intlify/vue-i18n/no-unused-keys': 'error',
48
+ '@intlify/vue-i18n/prefer-sfc-lang-attr': 'error',
49
+ '@intlify/vue-i18n/prefer-linked-key-with-paren': 'error',
50
+ // '@intlify/vue-i18n/sfc-locale-attr': 'error',
51
+
52
+ '@typescript-eslint/no-unused-vars': [
53
+ 'error',
54
+ {
55
+ argsIgnorePattern: '^_',
56
+ varsIgnorePattern: '^_',
57
+ },
58
+ ],
59
+ 'vue/multi-word-component-names': 'off', // TODO: remove (https://github.com/nuxt/eslint/issues/261)
60
+ 'yml/quotes': ['error', { prefer: 'single' }],
61
+ },
62
+ settings: {
63
+ polyfills: POLYFILLS,
64
+ 'vue-i18n': {
65
+ localeDir: './locales/*.json',
66
+ messageSyntaxVersion: '^9.0.0',
67
+ },
68
+ },
69
+ },
70
+ {
71
+ ignores: ['tests'],
72
+ },
73
+ {
74
+ files: ['locales/**/*'],
75
+ rules: {
76
+ '@intlify/vue-i18n/no-unused-keys': 'off',
77
+ },
78
+ }, // TODO: remove once `@intlify/eslint-plugin-vue-i18n` accounts for translation usage in composables]
79
+ ]
@@ -28,14 +28,14 @@ const { loadingIds, indicateLoadingDone } = useLoadingDoneIndicator('app')
28
28
  const init = () => {
29
29
  $dayjs.locale(locale.value)
30
30
 
31
- if (process.client) {
31
+ if (import.meta.client) {
32
32
  const cookieTimezone = useCookie(TIMEZONE_COOKIE_NAME, {
33
33
  // default: () => undefined, // setting `default` on the client side only does not write the cookie
34
34
  httpOnly: false,
35
35
  sameSite: 'strict',
36
36
  secure: true,
37
37
  })
38
- // @ts-ignore `tz` should be part of `$dayjs` (https://github.com/iamkun/dayjs/issues/2106)
38
+ // @ts-expect-error `tz` should be part of `$dayjs` (https://github.com/iamkun/dayjs/issues/2106)
39
39
  cookieTimezone.value = $dayjs.tz.guess()
40
40
  }
41
41
  }
@@ -27,7 +27,7 @@ const copy = async (string: string) => {
27
27
  try {
28
28
  await copyText(string)
29
29
  showToast({ title: t('donationUrlCopySuccess') })
30
- } catch (error: any) {
30
+ } catch (error: unknown) {
31
31
  alert(t('donationUrlCopyError'))
32
32
  }
33
33
  }
@@ -11,6 +11,5 @@ export const useDateTime = () => {
11
11
  : timezoneCookie.value || undefined
12
12
 
13
13
  return (dateTime?: string | number | Dayjs | Date | null) =>
14
- // @ts-ignore `tz` should be part of `$dayjs` (https://github.com/iamkun/dayjs/issues/2106)
15
14
  $dayjs(dateTime).tz(timezone)
16
15
  }
@@ -5,7 +5,7 @@ import type { Ref } from 'vue'
5
5
  export const useFireError = () => {
6
6
  const { t } = useI18n()
7
7
 
8
- return ({ error }: { error: Error }, api?: Ref<any>) => {
8
+ return ({ error }: { error: Error }, api?: Ref<{ errors: Error[] }>) => {
9
9
  Swal.fire({
10
10
  icon: 'error',
11
11
  title: t('globalStatusError'),
@@ -7,7 +7,7 @@ export const useLoadingDoneIndicator = (id?: string) => {
7
7
  if (!loadingId)
8
8
  throw createError({ statusCode: 500, statusMessage: 'Loading id missing!' })
9
9
 
10
- const loadingIdToAdd = `${process.server ? 'ssr' : 'csr'}_${loadingId}`
10
+ const loadingIdToAdd = `${import.meta.server ? 'ssr' : 'csr'}_${loadingId}`
11
11
 
12
12
  if (loadingIds.value.includes(loadingIdToAdd)) {
13
13
  throw createError({
@@ -18,7 +18,7 @@ export const useLoadingDoneIndicator = (id?: string) => {
18
18
 
19
19
  const loadingIdSsr = `ssr_${loadingId}`
20
20
 
21
- if (process.client && loadingIds.value.includes(loadingIdSsr)) {
21
+ if (import.meta.client && loadingIds.value.includes(loadingIdSsr)) {
22
22
  loadingIds.value.splice(loadingIds.value.indexOf(loadingIdSsr), 1)
23
23
  }
24
24
 
package/locales/de.json CHANGED
@@ -5,7 +5,6 @@
5
5
  "globalStatusLoading": "Lade...",
6
6
  "globalValidationFailed": "Bitte überprüfe deine Eingaben 🙈",
7
7
  "globalValidationFormat": "Falsches Format",
8
- "globalValidationFormatIncorrect": "Falsches Format",
9
8
  "globalValidationFormatUrlHttps": "Muss mit \"https://\" beginnen",
10
9
  "globalValidationLength": "Zu lang",
11
10
  "globalValidationRequired": "Pflichtfeld",
package/locales/en.json CHANGED
@@ -5,7 +5,6 @@
5
5
  "globalStatusLoading": "Loading...",
6
6
  "globalValidationFailed": "Please check your input 🙈",
7
7
  "globalValidationFormat": "Incorrect format",
8
- "globalValidationFormatIncorrect": "Incorrect format",
9
8
  "globalValidationFormatUrlHttps": "Must start with \"https://\"",
10
9
  "globalValidationLength": "Too long",
11
10
  "globalValidationRequired": "Required",
package/nuxt.config.ts CHANGED
@@ -39,6 +39,7 @@ export default defineNuxtConfig(
39
39
  modules: [
40
40
  '@dargmuesli/nuxt-cookie-control',
41
41
  '@nuxt/devtools',
42
+ '@nuxt/eslint',
42
43
  '@nuxt/image',
43
44
  '@nuxtjs/color-mode',
44
45
  '@nuxtjs/html-validator',
@@ -69,7 +70,7 @@ export default defineNuxtConfig(
69
70
  ;(
70
71
  nuxtConfigSecurity.headers.contentSecurityPolicy as Record<
71
72
  string,
72
- any
73
+ unknown
73
74
  >
74
75
  )[key] = [...new Set(valueFiltered)]
75
76
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dargmuesli/nuxt-vio",
3
- "version": "11.0.2",
3
+ "version": "11.1.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/dargmuesli/vio.git"
@@ -12,8 +12,9 @@
12
12
  "engines": {
13
13
  "node": "20"
14
14
  },
15
- "packageManager": "pnpm@8.15.6",
15
+ "packageManager": "pnpm@8.15.7",
16
16
  "files": [
17
+ ".config",
17
18
  "assets",
18
19
  "components",
19
20
  "composables",
@@ -60,8 +61,8 @@
60
61
  },
61
62
  "devDependencies": {
62
63
  "@axe-core/playwright": "4.9.0",
63
- "@intlify/eslint-plugin-vue-i18n": "3.0.0-next.9",
64
- "@nuxtjs/eslint-config-typescript": "12.1.0",
64
+ "@intlify/eslint-plugin-vue-i18n": "3.0.0-next.11",
65
+ "@nuxt/eslint": "0.3.7",
65
66
  "@playwright/test": "1.43.1",
66
67
  "@unhead/vue": "1.9.5",
67
68
  "@urql/devtools": "2.0.3",
@@ -71,12 +72,12 @@
71
72
  "cookie-es": "1.1.0",
72
73
  "cross-env": "7.0.3",
73
74
  "defu": "6.1.4",
74
- "eslint": "8.57.0",
75
+ "eslint": "9.0.0",
75
76
  "eslint-config-prettier": "9.1.0",
76
77
  "eslint-plugin-compat": "4.2.0",
77
- "eslint-plugin-nuxt": "4.0.0",
78
78
  "eslint-plugin-prettier": "5.1.3",
79
79
  "eslint-plugin-yml": "1.14.0",
80
+ "globals": "15.0.0",
80
81
  "h3": "1.11.1",
81
82
  "jiti": "1.21.0",
82
83
  "lint-staged": "15.2.2",
@@ -93,14 +94,14 @@
93
94
  "tailwindcss": "3.4.3",
94
95
  "ufo": "1.5.3",
95
96
  "unhead": "1.9.5",
96
- "vue": "3.4.21",
97
+ "vue": "3.4.22",
97
98
  "vue-router": "4.3.0",
98
99
  "vue-tsc": "2.0.13"
99
100
  },
100
101
  "peerDependencies": {
101
102
  "nuxt": "3.11.2",
102
103
  "playwright-core": "1.43.1",
103
- "vue": "3.4.21",
104
+ "vue": "3.4.22",
104
105
  "vue-router": "4.3.0"
105
106
  },
106
107
  "scripts": {
@@ -111,12 +112,12 @@
111
112
  "dev": "pnpm run start:dev",
112
113
  "generate": "pnpm run build:static",
113
114
  "lint:fix": "pnpm run lint:js --fix && pnpm run lint:ts --fix && pnpm run lint:style --fix",
114
- "lint:js": "eslint --cache --ext .js,.ts,.vue --ignore-path .gitignore .",
115
+ "lint:js": "eslint --cache .",
115
116
  "lint:staged": "lint-staged",
116
117
  "lint:style": "stylelint --cache \"**/*.{vue,css}\" --ignore-path .gitignore",
117
118
  "lint:ts": "nuxt typecheck",
118
119
  "lint": "pnpm run lint:js && pnpm run lint:ts && pnpm run lint:style",
119
- "prepare": "nuxt prepare .playground",
120
+ "prepare": "nuxt prepare && nuxt prepare .playground",
120
121
  "preview": "nuxt preview .playground",
121
122
  "start:dev": "nuxt dev .playground",
122
123
  "start:node": "node .playground/.output/server/index.mjs",
package/types/api.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { CombinedError } from '@urql/core'
2
2
 
3
3
  export type ApiData = ComputedRef<{
4
- data?: Object
4
+ data?: object
5
5
  errors: BackendError[]
6
6
  isFetching: boolean
7
7
  }>
@@ -1,5 +1,5 @@
1
1
  declare module '*.gql' {
2
- import { DocumentNode } from 'graphql'
2
+ import type { DocumentNode } from 'graphql'
3
3
 
4
4
  const content: DocumentNode
5
5
  export default content
@@ -1,5 +1,5 @@
1
1
  declare module '*.graphql' {
2
- import { DocumentNode } from 'graphql'
2
+ import type { DocumentNode } from 'graphql'
3
3
 
4
4
  const content: DocumentNode
5
5
  export default content
package/utils/auth.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { IncomingMessage, ServerResponse } from 'node:http'
1
+ import type { IncomingMessage, ServerResponse } from 'node:http'
2
2
 
3
3
  import { consola } from 'consola'
4
4
  import { parse, serialize } from 'cookie-es'
@@ -37,7 +37,7 @@ export const jwtStore = async ({
37
37
  res,
38
38
  jwt,
39
39
  }: {
40
- $urqlReset: Function
40
+ $urqlReset: () => void
41
41
  store: Store
42
42
  res?: ServerResponse
43
43
  jwt?: string
@@ -47,7 +47,7 @@ export const jwtStore = async ({
47
47
  consola.trace('Storing the following JWT: ' + jwt)
48
48
  ;(store as unknown as { jwtSet: (jwtNew?: string) => void }).jwtSet(jwt)
49
49
 
50
- if (process.server) {
50
+ if (import.meta.server) {
51
51
  res?.setHeader(
52
52
  'Set-Cookie',
53
53
  serialize(JWT_NAME(), jwt || '', {
@@ -64,7 +64,7 @@ export const jwtStore = async ({
64
64
  method: 'POST',
65
65
  ...(jwt ? { headers: { Authorization: `Bearer ${jwt}` } } : {}),
66
66
  })
67
- } catch (error: any) {
67
+ } catch (error: unknown) {
68
68
  return Promise.reject(Error('Authentication api call failed.'))
69
69
  }
70
70
  }
@@ -74,13 +74,10 @@ export const useJwtStore = () => {
74
74
  const { $urqlReset, ssrContext } = useNuxtApp()
75
75
  const store = useVioAuthStore()
76
76
 
77
- if (typeof $urqlReset !== 'function')
78
- throw new Error('`$urqlReset` is not a function!')
79
-
80
77
  return {
81
78
  async jwtStore(jwt?: string) {
82
79
  await jwtStore({
83
- $urqlReset,
80
+ $urqlReset: $urqlReset as () => void,
84
81
  store,
85
82
  res: ssrContext ? ssrContext.event.node.res : undefined,
86
83
  jwt,
@@ -94,7 +91,7 @@ export const signOut = async ({
94
91
  store,
95
92
  res,
96
93
  }: {
97
- $urqlReset: Function
94
+ $urqlReset: () => void
98
95
  store: Store
99
96
  res?: ServerResponse
100
97
  }) => await jwtStore({ $urqlReset, store, res })
@@ -109,7 +106,7 @@ export const useSignOut = () => {
109
106
  return {
110
107
  async signOut() {
111
108
  await signOut({
112
- $urqlReset,
109
+ $urqlReset: $urqlReset as () => void,
113
110
  store,
114
111
  res: ssrContext ? ssrContext.event.node.res : undefined,
115
112
  })
@@ -1,5 +1,5 @@
1
- import { CombinedError } from '@urql/core'
2
- import { H3Event, getCookie } from 'h3'
1
+ import type { CombinedError } from '@urql/core'
2
+ import { type H3Event, getCookie } from 'h3'
3
3
 
4
4
  import { type Ref } from 'vue'
5
5
 
@@ -103,7 +103,7 @@ export const getServiceHref = ({
103
103
 
104
104
  if (stagingHost) {
105
105
  return `https://${nameSubdomainString}${stagingHost}`
106
- } else if (isSsr && process.server) {
106
+ } else if (isSsr && import.meta.server) {
107
107
  return `http://${name}${portString}`
108
108
  } else {
109
109
  return `https://${nameSubdomainString}${getDomainTldPort(host)}`