Skip to content

Commit 4e45606

Browse files
committed
chore: upgrade lint rules
1 parent f78b34c commit 4e45606

File tree

16 files changed

+99
-178
lines changed

16 files changed

+99
-178
lines changed

.eslintignore

Lines changed: 0 additions & 6 deletions
This file was deleted.

.eslintrc.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

.vscode/settings.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
{
22
"editor.formatOnSave": true,
3-
"cSpell.words": ["unplugin"]
3+
"cSpell.words": ["unplugin"],
4+
"eslint.experimental.useFlatConfig": true,
5+
"eslint.options": {
6+
"overrideConfigFile": "./eslint.config.mjs"
7+
}
48
}

eslint.config.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { sxzz } from '@sxzz/eslint-config'
2+
3+
export default sxzz()

examples/webpack/webpack.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Vue from 'unplugin-vue/webpack'
22
import HtmlWebpackPlugin from 'html-webpack-plugin'
3-
import type { Configuration } from 'webpack'
3+
import { type Configuration } from 'webpack'
44

55
const config: Configuration = {
66
mode: (process.env.MODE as any) ?? 'development',

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"dev": "tsup --watch",
7171
"build": "tsup && tsx scripts/postbuild.mts",
7272
"release": "bumpp",
73-
"lint": "eslint . --ext .vue,.ts --max-warnings 0",
73+
"lint": "ESLINT_USE_FLAT_CONFIG=true eslint -c eslint.config.mjs --max-warnings 0 .",
7474
"typecheck": "tsc --noEmit",
7575
"prepublishOnly": "pnpm run build"
7676
},
@@ -92,8 +92,7 @@
9292
"devDependencies": {
9393
"@jridgewell/gen-mapping": "^0.3.3",
9494
"@jridgewell/trace-mapping": "^0.3.18",
95-
"@sxzz/eslint-config-prettier": "^2.4.6",
96-
"@sxzz/eslint-config-vue": "^2.4.6",
95+
"@sxzz/eslint-config": "^3.0.0-beta.11",
9796
"@types/debug": "^4.1.8",
9897
"@types/node": "^18.16.14",
9998
"@vitejs/plugin-vue": "4.2.3",

pnpm-lock.yaml

Lines changed: 36 additions & 114 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/core/handleHotUpdate.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import _debug from 'debug'
2-
import { isCSSRequest } from 'vite'
2+
import { type HmrContext, type ModuleNode, isCSSRequest } from 'vite'
3+
import { type SFCBlock, type SFCDescriptor } from 'vue/compiler-sfc'
34
import {
45
createDescriptor,
56
getDescriptor,
@@ -10,9 +11,7 @@ import {
1011
invalidateScript,
1112
setResolvedScript,
1213
} from './script'
13-
import type { HmrContext, ModuleNode } from 'vite'
14-
import type { SFCBlock, SFCDescriptor } from 'vue/compiler-sfc'
15-
import type { ResolvedOptions } from '.'
14+
import { type ResolvedOptions } from '.'
1615

1716
const debug = _debug('vite:hmr')
1817

src/core/index.ts

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
import fs from 'node:fs'
2-
import { createFilter, normalizePath } from 'vite'
3-
import { createUnplugin } from 'unplugin'
2+
import { type ViteDevServer, createFilter, normalizePath } from 'vite'
3+
import {
4+
type UnpluginContext,
5+
type UnpluginContextMeta,
6+
createUnplugin,
7+
} from 'unplugin'
8+
import {
9+
type SFCBlock,
10+
type SFCScriptCompileOptions,
11+
type SFCStyleCompileOptions,
12+
type SFCTemplateCompileOptions,
13+
// eslint-disable-next-line import/no-duplicates
14+
} from 'vue/compiler-sfc'
415
import { resolveCompiler } from '../core/compiler'
516
import { getResolvedScript, typeDepToSFCMap } from '../core/script'
617
import { transformMain } from '../core/main'
@@ -10,17 +21,8 @@ import { EXPORT_HELPER_ID, helperCode } from '../core/helper'
1021
import { getDescriptor, getSrcDescriptor } from './utils/descriptorCache'
1122
import { parseVueRequest } from './utils/query'
1223
import { handleHotUpdate, handleTypeDepChange } from './handleHotUpdate'
13-
import type { UnpluginContext, UnpluginContextMeta } from 'unplugin'
14-
import type { ViteDevServer } from 'vite'
15-
/* eslint-disable import/no-duplicates */
24+
// eslint-disable-next-line import/no-duplicates
1625
import type * as _compiler from 'vue/compiler-sfc'
17-
import type {
18-
SFCBlock,
19-
SFCScriptCompileOptions,
20-
SFCStyleCompileOptions,
21-
SFCTemplateCompileOptions,
22-
} from 'vue/compiler-sfc'
23-
/* eslint-enable import/no-duplicates */
2426

2527
export { parseVueRequest, type VueQuery } from './utils/query'
2628

src/core/main.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
import path from 'node:path'
22
import { normalizePath, transformWithEsbuild } from 'vite'
3-
import { TraceMap, eachMapping } from '@jridgewell/trace-mapping'
4-
import { addMapping, fromMap, toEncodedMap } from '@jridgewell/gen-mapping'
3+
import { type RawSourceMap } from 'source-map'
4+
import {
5+
type EncodedSourceMap as GenEncodedSourceMap,
6+
addMapping,
7+
fromMap,
8+
toEncodedMap,
9+
} from '@jridgewell/gen-mapping'
10+
import {
11+
type EncodedSourceMap as TraceEncodedSourceMap,
12+
TraceMap,
13+
eachMapping,
14+
} from '@jridgewell/trace-mapping'
15+
import { type PluginContext } from 'rollup'
16+
import { type SFCBlock, type SFCDescriptor } from 'vue/compiler-sfc'
517
import {
618
createDescriptor,
719
getPrevDescriptor,
@@ -17,12 +29,7 @@ import { transformTemplateInMain } from './template'
1729
import { isEqualBlock, isOnlyTemplateChanged } from './handleHotUpdate'
1830
import { createRollupError } from './utils/error'
1931
import { EXPORT_HELPER_ID } from './helper'
20-
import type { RawSourceMap } from 'source-map'
21-
import type { EncodedSourceMap as GenEncodedSourceMap } from '@jridgewell/gen-mapping'
22-
import type { EncodedSourceMap as TraceEncodedSourceMap } from '@jridgewell/trace-mapping'
23-
import type { Context, ResolvedOptions } from '.'
24-
import type { PluginContext } from 'rollup'
25-
import type { SFCBlock, SFCDescriptor } from 'vue/compiler-sfc'
32+
import { type Context, type ResolvedOptions } from '.'
2633

2734
export async function transformMain(
2835
code: string,

0 commit comments

Comments
 (0)