refactor: apply lints from @nuxtjs/eslint-config-typescript v11 (#7114)

Co-authored-by: Pooya Parsa <pooya@pi0.io>
This commit is contained in:
renovate[bot] 2022-08-31 20:34:17 +02:00 committed by GitHub
parent a9df4b75d6
commit e38e1de740
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 140 additions and 73 deletions

View File

@ -3,5 +3,8 @@
"import/ignore": [
"vue"
]
},
"rules": {
"vue/no-v-text-v-html-on-component": "off"
}
}

View File

@ -1,8 +1,8 @@
<script setup lang="ts">
const { count } = defineProps<{
const props = defineProps<{
count: number,
}>()
const doubled = $computed(() => count * 2)
const doubled = $computed(() => props.count * 2)
</script>
<template>

View File

@ -47,7 +47,7 @@
"unbuild": "^0.8.9"
},
"devDependencies": {
"@nuxtjs/eslint-config-typescript": "^10.0.0",
"@nuxtjs/eslint-config-typescript": "^11.0.0",
"@types/node": "^16.11.56",
"@types/rimraf": "^3",
"@unocss/reset": "^0.45.13",

View File

@ -9,10 +9,8 @@ const props = defineProps({
error: Object
})
const error = props.error
// TODO: extract to a separate utility
const stacktrace = (error.stack || '')
const stacktrace = (props.error.stack || '')
.split('\n')
.splice(1)
.map((line) => {
@ -29,12 +27,12 @@ const stacktrace = (error.stack || '')
}).map(i => `<span class="stack${i.internal ? ' internal' : ''}">${i.text}</span>`).join('\n')
// Error page props
const statusCode = Number(error.statusCode || 500)
const statusCode = Number(props.error.statusCode || 500)
const is404 = statusCode === 404
const statusMessage = error.statusMessage ?? (is404 ? 'Page Not Found' : 'Internal Server Error')
const description = error.message || error.toString()
const stack = process.dev && !is404 ? error.description || `<pre>${stacktrace}</pre>` : undefined
const statusMessage = props.error.statusMessage ?? (is404 ? 'Page Not Found' : 'Internal Server Error')
const description = props.error.message || props.error.toString()
const stack = process.dev && !is404 ? props.error.description || `<pre>${stacktrace}</pre>` : undefined
// TODO: Investigate side-effect issue with imports
const _Error404 = defineAsyncComponent(() => import('@nuxt/ui-templates/templates/error-404.vue'))

View File

@ -9,6 +9,7 @@ export * from './config'
export type { PageMeta } from '../pages/runtime'
// eslint-disable-next-line import/no-restricted-paths
export type { MetaObject } from '../head/runtime'
// eslint-disable-next-line import/no-restricted-paths
export { useHead, useMeta } from '#head'
export const isVue2 = false

View File

@ -4,8 +4,9 @@ import type { Manifest } from 'vite'
import { getQuery } from 'h3'
import devalue from '@nuxt/devalue'
import { renderToString as _renderToString } from 'vue/server-renderer'
import type { NuxtApp, NuxtSSRContext } from '#app'
import { useRuntimeConfig, useNitroApp, defineRenderHandler } from '#internal/nitro'
// eslint-disable-next-line import/no-restricted-paths
import type { NuxtApp, NuxtSSRContext } from '#app'
// @ts-ignore
import { buildAssetsURL } from '#paths'

View File

@ -67,6 +67,7 @@ const globalProps = {
// <script>
export const Script = defineComponent({
// eslint-disable-next-line vue/no-reserved-component-names
name: 'Script',
inheritAttrs: false,
props: {
@ -119,6 +120,7 @@ export const NoScript = defineComponent({
// <link>
export const Link = defineComponent({
// eslint-disable-next-line vue/no-reserved-component-names
name: 'Link',
inheritAttrs: false,
props: {
@ -154,6 +156,7 @@ export const Link = defineComponent({
// <base>
export const Base = defineComponent({
// eslint-disable-next-line vue/no-reserved-component-names
name: 'Base',
inheritAttrs: false,
props: {
@ -168,6 +171,7 @@ export const Base = defineComponent({
// <title>
export const Title = defineComponent({
// eslint-disable-next-line vue/no-reserved-component-names
name: 'Title',
inheritAttrs: false,
setup: setupForUseMeta((_, { slots }) => {
@ -183,6 +187,7 @@ export const Title = defineComponent({
// <meta>
export const Meta = defineComponent({
// eslint-disable-next-line vue/no-reserved-component-names
name: 'Meta',
inheritAttrs: false,
props: {
@ -199,6 +204,7 @@ export const Meta = defineComponent({
// <style>
export const Style = defineComponent({
// eslint-disable-next-line vue/no-reserved-component-names
name: 'Style',
inheritAttrs: false,
props: {
@ -230,6 +236,7 @@ export const Style = defineComponent({
// <head>
export const Head = defineComponent({
// eslint-disable-next-line vue/no-reserved-component-names
name: 'Head',
inheritAttrs: false,
setup: (_props, ctx) => () => ctx.slots.default?.()
@ -237,6 +244,7 @@ export const Head = defineComponent({
// <html>
export const Html = defineComponent({
// eslint-disable-next-line vue/no-reserved-component-names
name: 'Html',
inheritAttrs: false,
props: {
@ -250,6 +258,7 @@ export const Html = defineComponent({
// <body>
export const Body = defineComponent({
// eslint-disable-next-line vue/no-reserved-component-names
name: 'Body',
inheritAttrs: false,
props: globalProps,

View File

@ -66,7 +66,9 @@ const Component = defineComponent({
props: ['routeProps', 'pageKey', 'hasTransition'],
setup (props) {
// Prevent reactivity when the page will be rerendered in a different suspense fork
// eslint-disable-next-line vue/no-setup-props-destructure
const previousKey = props.pageKey
// eslint-disable-next-line vue/no-setup-props-destructure
const previousRoute = props.routeProps.route
// Provide a reactive route within the page

View File

@ -3,6 +3,7 @@ import { describe, expect, it } from 'vitest'
import { joinURL } from 'ufo'
// import { isWindows } from 'std-env'
import { setup, fetch, $fetch, startServer } from '@nuxt/test-utils'
// eslint-disable-next-line import/order
import { expectNoClientErrors, renderPage } from './utils'
await setup({

View File

@ -1,10 +1,10 @@
<script setup lang="ts">
const { count } = defineProps<{
const props = defineProps<{
count: number,
}>()
// eslint-disable-next-line prefer-const
let multiplier = $ref(2)
const doubled = $computed(() => count * multiplier)
const doubled = $computed(() => props.count * multiplier)
</script>
<template>

View File

@ -6,6 +6,7 @@ import type { AppConfig } from '@nuxt/schema'
import { NavigationFailure, RouteLocationNormalizedLoaded, RouteLocationRaw, useRouter as vueUseRouter } from 'vue-router'
import { defineNuxtConfig } from '~~/../../../packages/nuxt/src'
import type { NavigateToOptions } from '~~/../../../packages/nuxt/dist/app/composables/router'
// eslint-disable-next-line import/order
import { isVue3 } from '#app'
import { useRouter } from '#imports'

View File

@ -1,5 +1,5 @@
import { getBrowser, url, useTestContext } from '@nuxt/test-utils'
import { expect } from 'vitest'
import { getBrowser, url, useTestContext } from '@nuxt/test-utils'
export async function renderPage (path = '/') {
const ctx = useTestContext()

169
yarn.lock
View File

@ -236,7 +236,7 @@ __metadata:
languageName: node
linkType: hard
"@babel/helper-validator-identifier@npm:^7.15.7, @babel/helper-validator-identifier@npm:^7.18.6":
"@babel/helper-validator-identifier@npm:^7.18.6":
version: 7.18.6
resolution: "@babel/helper-validator-identifier@npm:7.18.6"
checksum: e295254d616bbe26e48c196a198476ab4d42a73b90478c9842536cf910ead887f5af6b5c4df544d3052a25ccb3614866fa808dc1e3a5a4291acd444e243c0648
@ -1893,35 +1893,35 @@ __metadata:
languageName: node
linkType: hard
"@nuxtjs/eslint-config-typescript@npm:^10.0.0":
version: 10.0.0
resolution: "@nuxtjs/eslint-config-typescript@npm:10.0.0"
"@nuxtjs/eslint-config-typescript@npm:^11.0.0":
version: 11.0.0
resolution: "@nuxtjs/eslint-config-typescript@npm:11.0.0"
dependencies:
"@nuxtjs/eslint-config": 10.0.0
"@typescript-eslint/eslint-plugin": ^5.21.0
"@typescript-eslint/parser": ^5.21.0
eslint-import-resolver-typescript: ^2.7.1
"@nuxtjs/eslint-config": ^11.0.0
"@typescript-eslint/eslint-plugin": ^5.36.1
"@typescript-eslint/parser": ^5.36.1
eslint-import-resolver-typescript: ^3.5.0
eslint-plugin-import: ^2.26.0
peerDependencies:
eslint: ^8.14.0
checksum: 683fbc3905ea7ae7ed77357637c1adaa30d72b0f257a36afbfa258c2bac25f289241c518d880322790e78c8b919eddbaccb4c73450299901c166b8b35c153700
eslint: ^8.23.0
checksum: 7e24a15c41901b70670773e97ffc2d9dbfcc232993b0cfe7179707c41e449fc7d0ac166612a8d56a2a1ec99b018de34872089e75fd39d9c373528e17e5c17f01
languageName: node
linkType: hard
"@nuxtjs/eslint-config@npm:10.0.0":
version: 10.0.0
resolution: "@nuxtjs/eslint-config@npm:10.0.0"
"@nuxtjs/eslint-config@npm:^11.0.0":
version: 11.0.0
resolution: "@nuxtjs/eslint-config@npm:11.0.0"
dependencies:
eslint-config-standard: ^17.0.0
eslint-plugin-import: ^2.26.0
eslint-plugin-n: ^15.2.0
eslint-plugin-n: ^15.2.5
eslint-plugin-node: ^11.1.0
eslint-plugin-promise: ^6.0.0
eslint-plugin-unicorn: ^42.0.0
eslint-plugin-vue: ^8.7.1
eslint-plugin-promise: ^6.0.1
eslint-plugin-unicorn: ^43.0.2
eslint-plugin-vue: ^9.4.0
peerDependencies:
eslint: ^8.14.0
checksum: 4b7bbba8ed9c131037d52fb970242d404c5b6c31640eeff4993270c31a602ea5b341123d8c6d3ef443119d535e278a4dcc1886dcd939fc95e381cd7f653f0019
eslint: ^8.23.0
checksum: 302632d6cb05d60630a7bd75fac35d23a2b19294a6f23c29ce8cbff20fc78fd6faa4edec37f3626fa4cbf0190130ff62a8efc51407ec192dd6f9323d5018dffe
languageName: node
linkType: hard
@ -2074,6 +2074,20 @@ __metadata:
languageName: node
linkType: hard
"@pkgr/utils@npm:^2.3.1":
version: 2.3.1
resolution: "@pkgr/utils@npm:2.3.1"
dependencies:
cross-spawn: ^7.0.3
is-glob: ^4.0.3
open: ^8.4.0
picocolors: ^1.0.0
tiny-glob: ^0.2.9
tslib: ^2.4.0
checksum: 118a1971120253740121a1db0a6658c21195b7da962acf9c124b507a3df707cfc97b0b84a16edcbd4352853b182e8337da9fc6e8e3d06c60d75ae4fb42321c75
languageName: node
linkType: hard
"@polka/url@npm:^1.0.0-next.20":
version: 1.0.0-next.21
resolution: "@polka/url@npm:1.0.0-next.21"
@ -2565,7 +2579,7 @@ __metadata:
languageName: node
linkType: hard
"@typescript-eslint/eslint-plugin@npm:^5.21.0":
"@typescript-eslint/eslint-plugin@npm:^5.36.1":
version: 5.36.1
resolution: "@typescript-eslint/eslint-plugin@npm:5.36.1"
dependencies:
@ -2588,7 +2602,7 @@ __metadata:
languageName: node
linkType: hard
"@typescript-eslint/parser@npm:^5.21.0":
"@typescript-eslint/parser@npm:^5.36.1":
version: 5.36.1
resolution: "@typescript-eslint/parser@npm:5.36.1"
dependencies:
@ -4296,7 +4310,7 @@ __metadata:
languageName: node
linkType: hard
"ci-info@npm:^3.3.0, ci-info@npm:^3.3.2":
"ci-info@npm:^3.3.2":
version: 3.3.2
resolution: "ci-info@npm:3.3.2"
checksum: fd81f1edd2d3b0f6cb077b2e84365136d87b9db8c055928c1ad69da8a76c2c2f19cba8ea51b90238302157ca927f91f92b653e933f2398dde4867500f08d6e62
@ -6048,19 +6062,21 @@ __metadata:
languageName: node
linkType: hard
"eslint-import-resolver-typescript@npm:^2.7.1":
version: 2.7.1
resolution: "eslint-import-resolver-typescript@npm:2.7.1"
"eslint-import-resolver-typescript@npm:^3.5.0":
version: 3.5.0
resolution: "eslint-import-resolver-typescript@npm:3.5.0"
dependencies:
debug: ^4.3.4
glob: ^7.2.0
enhanced-resolve: ^5.10.0
get-tsconfig: ^4.2.0
globby: ^13.1.2
is-core-module: ^2.10.0
is-glob: ^4.0.3
resolve: ^1.22.0
tsconfig-paths: ^3.14.1
synckit: ^0.8.3
peerDependencies:
eslint: "*"
eslint-plugin-import: "*"
checksum: 1d81b657b1f73bf95b8f0b745c0305574b91630c1db340318f3ca8918e206fce20a933b95e7c419338cc4452cb80bb2b2d92acaf01b6aa315c78a332d832545c
checksum: 9719d1f68b7bb0eaf8939cff2d3b02b526949f73db744877de781640650dd4d0a17d934222b9ac69e27d9f363ee4569c1aa1a2a2aab6500257517f9bf7d25976
languageName: node
linkType: hard
@ -6140,7 +6156,7 @@ __metadata:
languageName: node
linkType: hard
"eslint-plugin-n@npm:^15.2.0":
"eslint-plugin-n@npm:^15.2.5":
version: 15.2.5
resolution: "eslint-plugin-n@npm:15.2.5"
dependencies:
@ -6174,7 +6190,7 @@ __metadata:
languageName: node
linkType: hard
"eslint-plugin-promise@npm:^6.0.0":
"eslint-plugin-promise@npm:^6.0.1":
version: 6.0.1
resolution: "eslint-plugin-promise@npm:6.0.1"
peerDependencies:
@ -6183,12 +6199,12 @@ __metadata:
languageName: node
linkType: hard
"eslint-plugin-unicorn@npm:^42.0.0":
version: 42.0.0
resolution: "eslint-plugin-unicorn@npm:42.0.0"
"eslint-plugin-unicorn@npm:^43.0.2":
version: 43.0.2
resolution: "eslint-plugin-unicorn@npm:43.0.2"
dependencies:
"@babel/helper-validator-identifier": ^7.15.7
ci-info: ^3.3.0
"@babel/helper-validator-identifier": ^7.18.6
ci-info: ^3.3.2
clean-regexp: ^1.0.0
eslint-utils: ^3.0.0
esquery: ^1.4.0
@ -6199,27 +6215,28 @@ __metadata:
read-pkg-up: ^7.0.1
regexp-tree: ^0.1.24
safe-regex: ^2.1.1
semver: ^7.3.5
semver: ^7.3.7
strip-indent: ^3.0.0
peerDependencies:
eslint: ">=8.8.0"
checksum: 03757cbf417d39691fe04048ac9352585162a4dd68c2f26f5bc0956409625c7c4841487f0fa623e0d6dd5ff9cc3e758b74e4d170e3b0a877bbd0114995310058
eslint: ">=8.18.0"
checksum: 1b63eb013cbc0b3c9ef131a1e049b4b53d8e208393675d5f97d3fa83c050ebcb695a7fd210f4de1460f42f89c2ecca261280488834591d5c21e146d297a9ee2e
languageName: node
linkType: hard
"eslint-plugin-vue@npm:^8.7.1":
version: 8.7.1
resolution: "eslint-plugin-vue@npm:8.7.1"
"eslint-plugin-vue@npm:^9.4.0":
version: 9.4.0
resolution: "eslint-plugin-vue@npm:9.4.0"
dependencies:
eslint-utils: ^3.0.0
natural-compare: ^1.4.0
nth-check: ^2.0.1
postcss-selector-parser: ^6.0.9
semver: ^7.3.5
vue-eslint-parser: ^8.0.1
vue-eslint-parser: ^9.0.1
xml-name-validator: ^4.0.0
peerDependencies:
eslint: ^6.2.0 || ^7.0.0 || ^8.0.0
checksum: c3aefb226dea126db32cab4c570f17f4b4047d609f4f5748e8dc410e929fbbfacdc07af1421c0f7773398513e9363de4480694714bc85fa2188ca50d1d19cfbc
checksum: 1eb085e7d52285eff05e4a3f0f4d65619e943eb7e976b0ef59c3adc75bf4a089df8e8cdba223cf27e2623c0fc6b306e3b1ca460d0ce27cc421ca91b7880eb0d8
languageName: node
linkType: hard
@ -6233,7 +6250,7 @@ __metadata:
languageName: node
linkType: hard
"eslint-scope@npm:^7.0.0, eslint-scope@npm:^7.1.1":
"eslint-scope@npm:^7.1.1":
version: 7.1.1
resolution: "eslint-scope@npm:7.1.1"
dependencies:
@ -6277,7 +6294,7 @@ __metadata:
languageName: node
linkType: hard
"eslint-visitor-keys@npm:^3.1.0, eslint-visitor-keys@npm:^3.3.0":
"eslint-visitor-keys@npm:^3.3.0":
version: 3.3.0
resolution: "eslint-visitor-keys@npm:3.3.0"
checksum: d59e68a7c5a6d0146526b0eec16ce87fbf97fe46b8281e0d41384224375c4e52f5ffb9e16d48f4ea50785cde93f766b0c898e31ab89978d88b0e1720fbfb7808
@ -6333,7 +6350,7 @@ __metadata:
languageName: node
linkType: hard
"espree@npm:^9.0.0, espree@npm:^9.4.0":
"espree@npm:^9.3.1, espree@npm:^9.4.0":
version: 9.4.0
resolution: "espree@npm:9.4.0"
dependencies:
@ -7218,6 +7235,13 @@ __metadata:
languageName: node
linkType: hard
"get-tsconfig@npm:^4.2.0":
version: 4.2.0
resolution: "get-tsconfig@npm:4.2.0"
checksum: dfae3520bee20b71a651fdc93fd29901013dfc4df9fb41a423cf3efb4468c79087ef9d3bc3d0625b6486397730991d2a749eed4985d8ab411f481319c3e931e5
languageName: node
linkType: hard
"git-config-path@npm:^2.0.0":
version: 2.0.0
resolution: "git-config-path@npm:2.0.0"
@ -9931,7 +9955,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "nuxt-framework@workspace:."
dependencies:
"@nuxtjs/eslint-config-typescript": ^10.0.0
"@nuxtjs/eslint-config-typescript": ^11.0.0
"@types/node": ^16.11.56
"@types/rimraf": ^3
"@unocss/reset": ^0.45.13
@ -11855,7 +11879,7 @@ __metadata:
languageName: node
linkType: hard
"semver@npm:^7.0.0, semver@npm:^7.1.1, semver@npm:^7.3.4, semver@npm:^7.3.5, semver@npm:^7.3.7":
"semver@npm:^7.0.0, semver@npm:^7.1.1, semver@npm:^7.3.4, semver@npm:^7.3.5, semver@npm:^7.3.6, semver@npm:^7.3.7":
version: 7.3.7
resolution: "semver@npm:7.3.7"
dependencies:
@ -12445,6 +12469,16 @@ __metadata:
languageName: node
linkType: hard
"synckit@npm:^0.8.3":
version: 0.8.4
resolution: "synckit@npm:0.8.4"
dependencies:
"@pkgr/utils": ^2.3.1
tslib: ^2.4.0
checksum: 83e054fe4494dab42114fc4ed36a11b85e18742d304ade3f40d3afb4ba4145d76183adba1f29e2c36e9a0a453b93a83e2387505f96a0efd901f562927a968c44
languageName: node
linkType: hard
"tabbable@npm:^5.3.3":
version: 5.3.3
resolution: "tabbable@npm:5.3.3"
@ -12644,6 +12678,16 @@ __metadata:
languageName: node
linkType: hard
"tiny-glob@npm:^0.2.9":
version: 0.2.9
resolution: "tiny-glob@npm:0.2.9"
dependencies:
globalyzer: 0.1.0
globrex: ^0.1.2
checksum: aea5801eb6663ddf77ebb74900b8f8bd9dfcfc9b6a1cc8018cb7421590c00bf446109ff45e4b64a98e6c95ddb1255a337a5d488fb6311930e2a95334151ec9c6
languageName: node
linkType: hard
"tiny-invariant@npm:^1.1.0":
version: 1.2.0
resolution: "tiny-invariant@npm:1.2.0"
@ -12769,7 +12813,7 @@ __metadata:
languageName: node
linkType: hard
"tslib@npm:^2.1.0, tslib@npm:^2.3.0, tslib@npm:^2.3.1":
"tslib@npm:^2.1.0, tslib@npm:^2.3.0, tslib@npm:^2.3.1, tslib@npm:^2.4.0":
version: 2.4.0
resolution: "tslib@npm:2.4.0"
checksum: 8c4aa6a3c5a754bf76aefc38026134180c053b7bd2f81338cb5e5ebf96fefa0f417bff221592bf801077f5bf990562f6264fecbc42cd3309b33872cb6fc3b113
@ -13511,20 +13555,20 @@ __metadata:
languageName: node
linkType: hard
"vue-eslint-parser@npm:^8.0.1":
version: 8.3.0
resolution: "vue-eslint-parser@npm:8.3.0"
"vue-eslint-parser@npm:^9.0.1":
version: 9.0.3
resolution: "vue-eslint-parser@npm:9.0.3"
dependencies:
debug: ^4.3.2
eslint-scope: ^7.0.0
eslint-visitor-keys: ^3.1.0
espree: ^9.0.0
debug: ^4.3.4
eslint-scope: ^7.1.1
eslint-visitor-keys: ^3.3.0
espree: ^9.3.1
esquery: ^1.4.0
lodash: ^4.17.21
semver: ^7.3.5
semver: ^7.3.6
peerDependencies:
eslint: ">=6.0.0"
checksum: 8cc751e9fc2bfba93664ad8945732ab1c97791f9123e703de8669b65670d1e01906d80436bf4932d7ee6fa6174ed4545e8abb059206c88f4bd71957ca6cf7ba8
checksum: 61248eb504b8d0cbc95ed3f7ec6b11b72782cd76e4049798626f9c09031d620691a967231985c79d8ece8b04864797e465b7f47bcf91828e18344ae3691d9066
languageName: node
linkType: hard
@ -13955,6 +13999,13 @@ __metadata:
languageName: node
linkType: hard
"xml-name-validator@npm:^4.0.0":
version: 4.0.0
resolution: "xml-name-validator@npm:4.0.0"
checksum: af100b79c29804f05fa35aa3683e29a321db9b9685d5e5febda3fa1e40f13f85abc40f45a6b2bf7bee33f68a1dc5e8eaef4cec100a304a9db565e6061d4cb5ad
languageName: node
linkType: hard
"xtend@npm:~4.0.1":
version: 4.0.2
resolution: "xtend@npm:4.0.2"