File tree 12 files changed +36
-32
lines changed
12 files changed +36
-32
lines changed Original file line number Diff line number Diff line change @@ -89,7 +89,11 @@ module.exports = defineConfig({
89
89
'@typescript-eslint/no-inferrable-types' : 'off' ,
90
90
'@typescript-eslint/no-non-null-assertion' : 'off' , // maybe we should turn this on in a new PR
91
91
'@typescript-eslint/no-unused-vars' : 'off' , // maybe we should turn this on in a new PR
92
- '@typescript-eslint/no-var-requires' : 'off'
92
+ '@typescript-eslint/no-var-requires' : 'off' ,
93
+ '@typescript-eslint/consistent-type-imports' : [
94
+ 'error' ,
95
+ { prefer : 'type-imports' }
96
+ ]
93
97
} ,
94
98
overrides : [
95
99
{
Original file line number Diff line number Diff line change 1
- import { Plugin } from 'vite'
2
- import { VueJSXPluginOptions } from '@vue/babel-plugin-jsx'
3
- import { FilterPattern } from '@rollup/pluginutils'
1
+ import type { Plugin } from 'vite'
2
+ import type { VueJSXPluginOptions } from '@vue/babel-plugin-jsx'
3
+ import type { FilterPattern } from '@rollup/pluginutils'
4
4
5
5
declare interface FilterOptions {
6
6
include ?: FilterPattern
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ declare module 'vue/compiler-sfc' {
5
5
}
6
6
}
7
7
8
- import * as _compiler from 'vue/compiler-sfc'
8
+ import type * as _compiler from 'vue/compiler-sfc'
9
9
10
10
export function resolveCompiler ( root : string ) : typeof _compiler {
11
11
// resolve from project root first, then fallback to peer dep (if any)
Original file line number Diff line number Diff line change 1
1
import _debug from 'debug'
2
- import { SFCBlock , SFCDescriptor } from 'vue/compiler-sfc'
2
+ import type { SFCBlock , SFCDescriptor } from 'vue/compiler-sfc'
3
3
import {
4
4
createDescriptor ,
5
5
getDescriptor ,
6
6
setPrevDescriptor
7
7
} from './utils/descriptorCache'
8
8
import { getResolvedScript , setResolvedScript } from './script'
9
- import { ModuleNode , HmrContext } from 'vite'
10
- import { ResolvedOptions } from '.'
9
+ import type { ModuleNode , HmrContext } from 'vite'
10
+ import type { ResolvedOptions } from '.'
11
11
12
12
const debug = _debug ( 'vite:hmr' )
13
13
Original file line number Diff line number Diff line change 1
1
import fs from 'fs'
2
- import { Plugin , ViteDevServer } from 'vite'
2
+ import type { Plugin , ViteDevServer } from 'vite'
3
3
import { createFilter } from '@rollup/pluginutils'
4
- import {
4
+ import type {
5
5
SFCBlock ,
6
6
SFCScriptCompileOptions ,
7
7
SFCStyleCompileOptions ,
8
8
SFCTemplateCompileOptions
9
9
} from 'vue/compiler-sfc'
10
- import * as _compiler from 'vue/compiler-sfc'
10
+ import type * as _compiler from 'vue/compiler-sfc'
11
11
import { resolveCompiler } from './compiler'
12
12
import { parseVueRequest } from './utils/query'
13
13
import { getDescriptor , getSrcDescriptor } from './utils/descriptorCache'
Original file line number Diff line number Diff line change 1
1
import qs from 'querystring'
2
2
import path from 'path'
3
- import { SFCBlock , SFCDescriptor } from 'vue/compiler-sfc'
4
- import { ResolvedOptions } from '.'
3
+ import type { SFCBlock , SFCDescriptor } from 'vue/compiler-sfc'
4
+ import type { ResolvedOptions } from '.'
5
5
import {
6
6
createDescriptor ,
7
7
getPrevDescriptor ,
8
8
setSrcDescriptor
9
9
} from './utils/descriptorCache'
10
- import { PluginContext , SourceMap , TransformPluginContext } from 'rollup'
10
+ import type { PluginContext , SourceMap , TransformPluginContext } from 'rollup'
11
11
import { normalizePath } from '@rollup/pluginutils'
12
12
import { resolveScript , isUseInlineTemplate } from './script'
13
13
import { transformTemplateInMain } from './template'
14
14
import { isOnlyTemplateChanged , isEqualBlock } from './handleHotUpdate'
15
- import { RawSourceMap , SourceMapConsumer , SourceMapGenerator } from 'source-map'
15
+ import type { RawSourceMap } from 'source-map'
16
+ import { SourceMapConsumer , SourceMapGenerator } from 'source-map'
16
17
import { createRollupError } from './utils/error'
17
18
import { transformWithEsbuild } from 'vite'
18
19
import { EXPORT_HELPER_ID } from './helper'
Original file line number Diff line number Diff line change 1
- import { SFCDescriptor , SFCScriptBlock } from 'vue/compiler-sfc'
2
- import { ResolvedOptions } from '.'
1
+ import type { SFCDescriptor , SFCScriptBlock } from 'vue/compiler-sfc'
2
+ import type { ResolvedOptions } from '.'
3
3
import { resolveTemplateCompilerOptions } from './template'
4
4
5
5
// ssr and non ssr builds would output different script content
Original file line number Diff line number Diff line change 1
- import { SFCDescriptor } from 'vue/compiler-sfc'
2
- import { TransformPluginContext } from 'rollup'
3
- import { ResolvedOptions } from '.'
1
+ import type { SFCDescriptor } from 'vue/compiler-sfc'
2
+ import type { TransformPluginContext } from 'rollup'
3
+ import type { ResolvedOptions } from '.'
4
4
5
5
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
6
6
export async function transformStyle (
Original file line number Diff line number Diff line change 1
1
import path from 'path'
2
2
import slash from 'slash'
3
- import {
3
+ import type {
4
4
SFCDescriptor ,
5
5
SFCTemplateCompileOptions ,
6
6
SFCTemplateCompileResults ,
7
7
CompilerOptions
8
8
} from 'vue/compiler-sfc'
9
- import { PluginContext , TransformPluginContext } from 'rollup'
10
- import { ResolvedOptions } from '.'
9
+ import type { PluginContext , TransformPluginContext } from 'rollup'
10
+ import type { ResolvedOptions } from '.'
11
11
import { getResolvedScript } from './script'
12
12
import { createRollupError } from './utils/error'
13
13
Original file line number Diff line number Diff line change @@ -2,8 +2,8 @@ import fs from 'fs'
2
2
import path from 'path'
3
3
import slash from 'slash'
4
4
import hash from 'hash-sum'
5
- import { CompilerError , SFCDescriptor } from 'vue/compiler-sfc'
6
- import { ResolvedOptions , VueQuery } from '..'
5
+ import type { CompilerError , SFCDescriptor } from 'vue/compiler-sfc'
6
+ import type { ResolvedOptions , VueQuery } from '..'
7
7
8
8
// compiler-sfc should be exported so it can be re-used
9
9
export interface SFCParseResult {
Original file line number Diff line number Diff line change 1
- import { CompilerError } from 'vue/compiler-sfc'
2
- import { RollupError } from 'rollup'
1
+ import type { CompilerError } from 'vue/compiler-sfc'
2
+ import type { RollupError } from 'rollup'
3
3
4
4
export function createRollupError (
5
5
id : string ,
Original file line number Diff line number Diff line change @@ -2,18 +2,17 @@ import fs from 'fs-extra'
2
2
import * as http from 'http'
3
3
import { resolve , dirname } from 'path'
4
4
import sirv from 'sirv'
5
- import {
6
- createServer ,
7
- build ,
5
+ import type {
8
6
ViteDevServer ,
9
7
UserConfig ,
10
8
PluginOption ,
11
9
ResolvedConfig ,
12
10
Logger
13
11
} from 'vite'
14
- import { Page } from 'playwright-chromium'
12
+ import { createServer , build } from 'vite'
13
+ import type { Page } from 'playwright-chromium'
15
14
// eslint-disable-next-line node/no-extraneous-import
16
- import { RollupError , RollupWatcher , RollupWatcherEvent } from 'rollup'
15
+ import type { RollupError , RollupWatcher , RollupWatcherEvent } from 'rollup'
17
16
18
17
const isBuildTest = ! ! process . env . VITE_TEST_BUILD
19
18
You can’t perform that action at this time.
0 commit comments