From cb7f079ac492a018dcd29863624099f103db4fc8 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Mon, 9 Aug 2021 18:18:21 +0200 Subject: [PATCH] chore: fix lint issues [skip-release] using `import type` seems a regression of `import/named` rule but generally makes it more readable to prefer using it :) --- .eslintignore | 1 + packages/app/src/composables/asyncData.ts | 3 ++- packages/app/src/composables/component.ts | 3 ++- packages/app/src/composables/data.ts | 3 ++- packages/app/src/nuxt.ts | 3 ++- packages/app/types/shims.d.ts | 1 + packages/meta/src/runtime/components.ts | 3 ++- packages/meta/src/runtime/composables.ts | 3 ++- packages/nitro/src/rollup/config.ts | 4 ++-- packages/nitro/src/rollup/plugins/esbuild.ts | 5 +++-- packages/nitro/src/rollup/plugins/virtual.ts | 4 ++-- packages/vite/src/plugins/virtual.ts | 3 +-- 12 files changed, 22 insertions(+), 14 deletions(-) diff --git a/.eslintignore b/.eslintignore index 71d1e38ba7..b4e98865ca 100644 --- a/.eslintignore +++ b/.eslintignore @@ -3,3 +3,4 @@ node_modules _templates schema **/*.tmpl.* +sw.js diff --git a/packages/app/src/composables/asyncData.ts b/packages/app/src/composables/asyncData.ts index 550007c9b6..270e322df1 100644 --- a/packages/app/src/composables/asyncData.ts +++ b/packages/app/src/composables/asyncData.ts @@ -1,4 +1,5 @@ -import { getCurrentInstance, onBeforeMount, onUnmounted, Ref, ref, unref, UnwrapRef } from 'vue' +import { getCurrentInstance, onBeforeMount, onUnmounted, ref, unref } from 'vue' +import type { UnwrapRef, Ref } from 'vue' import { Nuxt, useNuxt } from '@nuxt/app' import { NuxtComponentPendingPromises } from './component' diff --git a/packages/app/src/composables/component.ts b/packages/app/src/composables/component.ts index a50ce74fe4..29cb245232 100644 --- a/packages/app/src/composables/component.ts +++ b/packages/app/src/composables/component.ts @@ -1,5 +1,6 @@ import { toRefs } from '@vue/reactivity' -import { ComponentInternalInstance, DefineComponent, defineComponent, getCurrentInstance } from 'vue' +import { defineComponent, getCurrentInstance } from 'vue' +import type { ComponentInternalInstance, DefineComponent } from 'vue' import { useRoute } from 'vue-router' import type { LegacyContext } from '../legacy' import { useNuxt } from '../nuxt' diff --git a/packages/app/src/composables/data.ts b/packages/app/src/composables/data.ts index 1dd6df9181..a023cfbbc8 100644 --- a/packages/app/src/composables/data.ts +++ b/packages/app/src/composables/data.ts @@ -1,4 +1,5 @@ -import { getCurrentInstance, isReactive, reactive, UnwrapRef } from 'vue' +import { getCurrentInstance, isReactive, reactive } from 'vue' +import type { UnwrapRef } from 'vue' import { useNuxt } from '@nuxt/app' export function ensureReactive< diff --git a/packages/app/src/nuxt.ts b/packages/app/src/nuxt.ts index e4452ad758..5b3b7d22f9 100644 --- a/packages/app/src/nuxt.ts +++ b/packages/app/src/nuxt.ts @@ -1,4 +1,5 @@ -import { App, getCurrentInstance } from 'vue' +import { getCurrentInstance } from 'vue' +import type { App } from 'vue' import Hookable from 'hookable' import { defineGetter } from './utils' import { legacyPlugin, LegacyContext } from './legacy' diff --git a/packages/app/types/shims.d.ts b/packages/app/types/shims.d.ts index 95808a5dda..d4faf3ef4e 100644 --- a/packages/app/types/shims.d.ts +++ b/packages/app/types/shims.d.ts @@ -1,3 +1,4 @@ +// eslint-disable-next-line import/default import Vue from 'vue' import { $Fetch } from 'ohmyfetch' import { Nuxt } from '../dist' diff --git a/packages/meta/src/runtime/components.ts b/packages/meta/src/runtime/components.ts index 6af01fa28b..75625dfe82 100644 --- a/packages/meta/src/runtime/components.ts +++ b/packages/meta/src/runtime/components.ts @@ -1,4 +1,5 @@ -import { defineComponent, SetupContext } from 'vue' +import { defineComponent } from 'vue' +import type { SetupContext } from 'vue' import { useMeta } from './composables' type Props = Readonly> diff --git a/packages/meta/src/runtime/composables.ts b/packages/meta/src/runtime/composables.ts index a36c5051af..426b5ade83 100644 --- a/packages/meta/src/runtime/composables.ts +++ b/packages/meta/src/runtime/composables.ts @@ -1,6 +1,7 @@ // import { useMeta as useVueMeta } from 'vue-meta' import { isFunction } from '@vue/shared' -import { computed, ComputedGetter } from '@vue/reactivity' +import { computed } from '@vue/reactivity' +import type { ComputedGetter } from '@vue/reactivity' import { useNuxt } from '@nuxt/app' import type { MetaObject } from '@nuxt/meta' diff --git a/packages/nitro/src/rollup/config.ts b/packages/nitro/src/rollup/config.ts index 28b6b9b7d5..1d565c9101 100644 --- a/packages/nitro/src/rollup/config.ts +++ b/packages/nitro/src/rollup/config.ts @@ -1,9 +1,9 @@ import { dirname, join, normalize, relative, resolve } from 'upath' -import { InputOptions, OutputOptions } from 'rollup' +import type { InputOptions, OutputOptions } from 'rollup' import defu from 'defu' import { terser } from 'rollup-plugin-terser' import commonjs from '@rollup/plugin-commonjs' -import nodeResolve from '@rollup/plugin-node-resolve' +import { nodeResolve } from '@rollup/plugin-node-resolve' import alias from '@rollup/plugin-alias' import json from '@rollup/plugin-json' import replace from '@rollup/plugin-replace' diff --git a/packages/nitro/src/rollup/plugins/esbuild.ts b/packages/nitro/src/rollup/plugins/esbuild.ts index 7217e3e82d..d34332eea2 100644 --- a/packages/nitro/src/rollup/plugins/esbuild.ts +++ b/packages/nitro/src/rollup/plugins/esbuild.ts @@ -1,9 +1,10 @@ // Based on https://github.com/egoist/rollup-plugin-esbuild (MIT) import { extname, relative } from 'upath' -import { Plugin, PluginContext } from 'rollup' +import type { Plugin, PluginContext } from 'rollup' import { Loader, TransformResult, transform } from 'esbuild' -import { createFilter, FilterPattern } from '@rollup/pluginutils' +import { createFilter } from '@rollup/pluginutils' +import type { FilterPattern } from '@rollup/pluginutils' const defaultLoaders: { [ext: string]: Loader } = { '.ts': 'ts', diff --git a/packages/nitro/src/rollup/plugins/virtual.ts b/packages/nitro/src/rollup/plugins/virtual.ts index 7d3ed6d118..1a6555dffb 100644 --- a/packages/nitro/src/rollup/plugins/virtual.ts +++ b/packages/nitro/src/rollup/plugins/virtual.ts @@ -1,7 +1,7 @@ -// Based on https://github.com/rollup/plugins/blob/master/packages/virtual/src/index.ts import * as path from 'upath' +import type { Plugin } from 'rollup' -import { Plugin } from 'rollup' +// Based on https://github.com/rollup/plugins/blob/master/packages/virtual/src/index.ts type VirtualModule = string | { load: () => string | Promise } diff --git a/packages/vite/src/plugins/virtual.ts b/packages/vite/src/plugins/virtual.ts index 5fae9bf406..697c5cf1ac 100644 --- a/packages/vite/src/plugins/virtual.ts +++ b/packages/vite/src/plugins/virtual.ts @@ -1,6 +1,5 @@ import { dirname, join } from 'upath' - -import { Plugin } from 'rollup' +import type { Plugin } from 'rollup' const PREFIX = '\0virtual:'