Skip to content
This repository was archived by the owner on Apr 6, 2023. It is now read-only.

Commit e38e1de

Browse files
renovate[bot]pi0
andauthored
refactor: apply lints from @nuxtjs/eslint-config-typescript v11 (#7114)
Co-authored-by: Pooya Parsa <[email protected]>
1 parent a9df4b7 commit e38e1de

File tree

13 files changed

+140
-73
lines changed

13 files changed

+140
-73
lines changed

docs/.eslintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,8 @@
33
"import/ignore": [
44
"vue"
55
]
6+
},
7+
"rules": {
8+
"vue/no-v-text-v-html-on-component": "off"
69
}
710
}

examples/experimental/reactivity-transform/components/label.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<script setup lang="ts">
2-
const { count } = defineProps<{
2+
const props = defineProps<{
33
count: number,
44
}>()
5-
const doubled = $computed(() => count * 2)
5+
const doubled = $computed(() => props.count * 2)
66
</script>
77

88
<template>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"unbuild": "^0.8.9"
4848
},
4949
"devDependencies": {
50-
"@nuxtjs/eslint-config-typescript": "^10.0.0",
50+
"@nuxtjs/eslint-config-typescript": "^11.0.0",
5151
"@types/node": "^16.11.56",
5252
"@types/rimraf": "^3",
5353
"@unocss/reset": "^0.45.13",

packages/nuxt/src/app/components/nuxt-error-page.vue

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@ const props = defineProps({
99
error: Object
1010
})
1111
12-
const error = props.error
13-
1412
// TODO: extract to a separate utility
15-
const stacktrace = (error.stack || '')
13+
const stacktrace = (props.error.stack || '')
1614
.split('\n')
1715
.splice(1)
1816
.map((line) => {
@@ -29,12 +27,12 @@ const stacktrace = (error.stack || '')
2927
}).map(i => `<span class="stack${i.internal ? ' internal' : ''}">${i.text}</span>`).join('\n')
3028
3129
// Error page props
32-
const statusCode = Number(error.statusCode || 500)
30+
const statusCode = Number(props.error.statusCode || 500)
3331
const is404 = statusCode === 404
3432
35-
const statusMessage = error.statusMessage ?? (is404 ? 'Page Not Found' : 'Internal Server Error')
36-
const description = error.message || error.toString()
37-
const stack = process.dev && !is404 ? error.description || `<pre>${stacktrace}</pre>` : undefined
33+
const statusMessage = props.error.statusMessage ?? (is404 ? 'Page Not Found' : 'Internal Server Error')
34+
const description = props.error.message || props.error.toString()
35+
const stack = process.dev && !is404 ? props.error.description || `<pre>${stacktrace}</pre>` : undefined
3836
3937
// TODO: Investigate side-effect issue with imports
4038
const _Error404 = defineAsyncComponent(() => import('@nuxt/ui-templates/templates/error-404.vue'))

packages/nuxt/src/app/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export * from './config'
99
export type { PageMeta } from '../pages/runtime'
1010
// eslint-disable-next-line import/no-restricted-paths
1111
export type { MetaObject } from '../head/runtime'
12+
// eslint-disable-next-line import/no-restricted-paths
1213
export { useHead, useMeta } from '#head'
1314

1415
export const isVue2 = false

packages/nuxt/src/core/runtime/nitro/renderer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ import type { Manifest } from 'vite'
44
import { getQuery } from 'h3'
55
import devalue from '@nuxt/devalue'
66
import { renderToString as _renderToString } from 'vue/server-renderer'
7-
import type { NuxtApp, NuxtSSRContext } from '#app'
87
import { useRuntimeConfig, useNitroApp, defineRenderHandler } from '#internal/nitro'
8+
// eslint-disable-next-line import/no-restricted-paths
9+
import type { NuxtApp, NuxtSSRContext } from '#app'
910

1011
// @ts-ignore
1112
import { buildAssetsURL } from '#paths'

packages/nuxt/src/head/runtime/components.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ const globalProps = {
6767

6868
// <script>
6969
export const Script = defineComponent({
70+
// eslint-disable-next-line vue/no-reserved-component-names
7071
name: 'Script',
7172
inheritAttrs: false,
7273
props: {
@@ -119,6 +120,7 @@ export const NoScript = defineComponent({
119120

120121
// <link>
121122
export const Link = defineComponent({
123+
// eslint-disable-next-line vue/no-reserved-component-names
122124
name: 'Link',
123125
inheritAttrs: false,
124126
props: {
@@ -154,6 +156,7 @@ export const Link = defineComponent({
154156

155157
// <base>
156158
export const Base = defineComponent({
159+
// eslint-disable-next-line vue/no-reserved-component-names
157160
name: 'Base',
158161
inheritAttrs: false,
159162
props: {
@@ -168,6 +171,7 @@ export const Base = defineComponent({
168171

169172
// <title>
170173
export const Title = defineComponent({
174+
// eslint-disable-next-line vue/no-reserved-component-names
171175
name: 'Title',
172176
inheritAttrs: false,
173177
setup: setupForUseMeta((_, { slots }) => {
@@ -183,6 +187,7 @@ export const Title = defineComponent({
183187

184188
// <meta>
185189
export const Meta = defineComponent({
190+
// eslint-disable-next-line vue/no-reserved-component-names
186191
name: 'Meta',
187192
inheritAttrs: false,
188193
props: {
@@ -199,6 +204,7 @@ export const Meta = defineComponent({
199204

200205
// <style>
201206
export const Style = defineComponent({
207+
// eslint-disable-next-line vue/no-reserved-component-names
202208
name: 'Style',
203209
inheritAttrs: false,
204210
props: {
@@ -230,13 +236,15 @@ export const Style = defineComponent({
230236

231237
// <head>
232238
export const Head = defineComponent({
239+
// eslint-disable-next-line vue/no-reserved-component-names
233240
name: 'Head',
234241
inheritAttrs: false,
235242
setup: (_props, ctx) => () => ctx.slots.default?.()
236243
})
237244

238245
// <html>
239246
export const Html = defineComponent({
247+
// eslint-disable-next-line vue/no-reserved-component-names
240248
name: 'Html',
241249
inheritAttrs: false,
242250
props: {
@@ -250,6 +258,7 @@ export const Html = defineComponent({
250258

251259
// <body>
252260
export const Body = defineComponent({
261+
// eslint-disable-next-line vue/no-reserved-component-names
253262
name: 'Body',
254263
inheritAttrs: false,
255264
props: globalProps,

packages/nuxt/src/pages/runtime/page.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ const Component = defineComponent({
6666
props: ['routeProps', 'pageKey', 'hasTransition'],
6767
setup (props) {
6868
// Prevent reactivity when the page will be rerendered in a different suspense fork
69+
// eslint-disable-next-line vue/no-setup-props-destructure
6970
const previousKey = props.pageKey
71+
// eslint-disable-next-line vue/no-setup-props-destructure
7072
const previousRoute = props.routeProps.route
7173

7274
// Provide a reactive route within the page

test/basic.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { describe, expect, it } from 'vitest'
33
import { joinURL } from 'ufo'
44
// import { isWindows } from 'std-env'
55
import { setup, fetch, $fetch, startServer } from '@nuxt/test-utils'
6+
// eslint-disable-next-line import/order
67
import { expectNoClientErrors, renderPage } from './utils'
78

89
await setup({

test/fixtures/basic/components/SugarCounter.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<script setup lang="ts">
2-
const { count } = defineProps<{
2+
const props = defineProps<{
33
count: number,
44
}>()
55
// eslint-disable-next-line prefer-const
66
let multiplier = $ref(2)
7-
const doubled = $computed(() => count * multiplier)
7+
const doubled = $computed(() => props.count * multiplier)
88
</script>
99

1010
<template>

test/fixtures/basic/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import type { AppConfig } from '@nuxt/schema'
66
import { NavigationFailure, RouteLocationNormalizedLoaded, RouteLocationRaw, useRouter as vueUseRouter } from 'vue-router'
77
import { defineNuxtConfig } from '~~/../../../packages/nuxt/src'
88
import type { NavigateToOptions } from '~~/../../../packages/nuxt/dist/app/composables/router'
9+
// eslint-disable-next-line import/order
910
import { isVue3 } from '#app'
1011
import { useRouter } from '#imports'
1112

test/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { getBrowser, url, useTestContext } from '@nuxt/test-utils'
21
import { expect } from 'vitest'
2+
import { getBrowser, url, useTestContext } from '@nuxt/test-utils'
33

44
export async function renderPage (path = '/') {
55
const ctx = useTestContext()

0 commit comments

Comments
 (0)