Skip to content

Commit

Permalink
chore: upgrade lint rules
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed May 24, 2023
1 parent f78b34c commit 4e45606
Show file tree
Hide file tree
Showing 16 changed files with 99 additions and 178 deletions.
6 changes: 0 additions & 6 deletions .eslintignore

This file was deleted.

9 changes: 0 additions & 9 deletions .eslintrc.js

This file was deleted.

6 changes: 5 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"editor.formatOnSave": true,
"cSpell.words": ["unplugin"]
"cSpell.words": ["unplugin"],
"eslint.experimental.useFlatConfig": true,
"eslint.options": {
"overrideConfigFile": "./eslint.config.mjs"
}
}
3 changes: 3 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { sxzz } from '@sxzz/eslint-config'

export default sxzz()
2 changes: 1 addition & 1 deletion examples/webpack/webpack.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Vue from 'unplugin-vue/webpack'
import HtmlWebpackPlugin from 'html-webpack-plugin'
import type { Configuration } from 'webpack'
import { type Configuration } from 'webpack'

const config: Configuration = {
mode: (process.env.MODE as any) ?? 'development',
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"dev": "tsup --watch",
"build": "tsup && tsx scripts/postbuild.mts",
"release": "bumpp",
"lint": "eslint . --ext .vue,.ts --max-warnings 0",
"lint": "ESLINT_USE_FLAT_CONFIG=true eslint -c eslint.config.mjs --max-warnings 0 .",
"typecheck": "tsc --noEmit",
"prepublishOnly": "pnpm run build"
},
Expand All @@ -92,8 +92,7 @@
"devDependencies": {
"@jridgewell/gen-mapping": "^0.3.3",
"@jridgewell/trace-mapping": "^0.3.18",
"@sxzz/eslint-config-prettier": "^2.4.6",
"@sxzz/eslint-config-vue": "^2.4.6",
"@sxzz/eslint-config": "^3.0.0-beta.11",
"@types/debug": "^4.1.8",
"@types/node": "^18.16.14",
"@vitejs/plugin-vue": "4.2.3",
Expand Down
150 changes: 36 additions & 114 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions src/core/handleHotUpdate.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import _debug from 'debug'
import { isCSSRequest } from 'vite'
import { type HmrContext, type ModuleNode, isCSSRequest } from 'vite'
import { type SFCBlock, type SFCDescriptor } from 'vue/compiler-sfc'
import {
createDescriptor,
getDescriptor,
Expand All @@ -10,9 +11,7 @@ import {
invalidateScript,
setResolvedScript,
} from './script'
import type { HmrContext, ModuleNode } from 'vite'
import type { SFCBlock, SFCDescriptor } from 'vue/compiler-sfc'
import type { ResolvedOptions } from '.'
import { type ResolvedOptions } from '.'

const debug = _debug('vite:hmr')

Expand Down
26 changes: 14 additions & 12 deletions src/core/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
import fs from 'node:fs'
import { createFilter, normalizePath } from 'vite'
import { createUnplugin } from 'unplugin'
import { type ViteDevServer, createFilter, normalizePath } from 'vite'
import {
type UnpluginContext,
type UnpluginContextMeta,
createUnplugin,
} from 'unplugin'
import {
type SFCBlock,
type SFCScriptCompileOptions,
type SFCStyleCompileOptions,
type SFCTemplateCompileOptions,
// eslint-disable-next-line import/no-duplicates
} from 'vue/compiler-sfc'
import { resolveCompiler } from '../core/compiler'
import { getResolvedScript, typeDepToSFCMap } from '../core/script'
import { transformMain } from '../core/main'
Expand All @@ -10,17 +21,8 @@ import { EXPORT_HELPER_ID, helperCode } from '../core/helper'
import { getDescriptor, getSrcDescriptor } from './utils/descriptorCache'
import { parseVueRequest } from './utils/query'
import { handleHotUpdate, handleTypeDepChange } from './handleHotUpdate'
import type { UnpluginContext, UnpluginContextMeta } from 'unplugin'
import type { ViteDevServer } from 'vite'
/* eslint-disable import/no-duplicates */
// eslint-disable-next-line import/no-duplicates
import type * as _compiler from 'vue/compiler-sfc'
import type {
SFCBlock,
SFCScriptCompileOptions,
SFCStyleCompileOptions,
SFCTemplateCompileOptions,
} from 'vue/compiler-sfc'
/* eslint-enable import/no-duplicates */

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

Expand Down
23 changes: 15 additions & 8 deletions src/core/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
import path from 'node:path'
import { normalizePath, transformWithEsbuild } from 'vite'
import { TraceMap, eachMapping } from '@jridgewell/trace-mapping'
import { addMapping, fromMap, toEncodedMap } from '@jridgewell/gen-mapping'
import { type RawSourceMap } from 'source-map'
import {
type EncodedSourceMap as GenEncodedSourceMap,
addMapping,
fromMap,
toEncodedMap,
} from '@jridgewell/gen-mapping'
import {
type EncodedSourceMap as TraceEncodedSourceMap,
TraceMap,
eachMapping,
} from '@jridgewell/trace-mapping'
import { type PluginContext } from 'rollup'
import { type SFCBlock, type SFCDescriptor } from 'vue/compiler-sfc'
import {
createDescriptor,
getPrevDescriptor,
Expand All @@ -17,12 +29,7 @@ import { transformTemplateInMain } from './template'
import { isEqualBlock, isOnlyTemplateChanged } from './handleHotUpdate'
import { createRollupError } from './utils/error'
import { EXPORT_HELPER_ID } from './helper'
import type { RawSourceMap } from 'source-map'
import type { EncodedSourceMap as GenEncodedSourceMap } from '@jridgewell/gen-mapping'
import type { EncodedSourceMap as TraceEncodedSourceMap } from '@jridgewell/trace-mapping'
import type { Context, ResolvedOptions } from '.'
import type { PluginContext } from 'rollup'
import type { SFCBlock, SFCDescriptor } from 'vue/compiler-sfc'
import { type Context, type ResolvedOptions } from '.'

export async function transformMain(
code: string,
Expand Down

0 comments on commit 4e45606

Please sign in to comment.