Skip to content

Commit

Permalink
chore: upgrade eslint config
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed May 5, 2023
1 parent ed7ca8c commit 1bacbc9
Show file tree
Hide file tree
Showing 40 changed files with 166 additions and 118 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -34,7 +34,7 @@
"@babel/types": "^7.21.4",
"@changesets/changelog-github": "^0.4.8",
"@changesets/cli": "^2.26.1",
"@sxzz/eslint-config": "^3.0.0-beta.9",
"@sxzz/eslint-config": "^3.0.0-beta.10",
"@types/node": "^18.16.0",
"@vitest/coverage-c8": "^0.30.1",
"@vitest/ui": "^0.30.1",
Expand Down
3 changes: 1 addition & 2 deletions packages/api/src/ts.ts
Expand Up @@ -8,8 +8,6 @@ import {
resolveLiteral,
resolveObjectKey,
} from '@vue-macros/common'
import { isDeclaration } from '@babel/types'

import {
type Identifier,
type ImportNamespaceSpecifier,
Expand All @@ -35,6 +33,7 @@ import {
type TSTypeElement,
type TSTypeLiteral,
type UnaryExpression,
isDeclaration,
} from '@babel/types'

export type TSDeclaration =
Expand Down
8 changes: 4 additions & 4 deletions packages/api/src/vue/analyze.ts
@@ -1,21 +1,21 @@
import {
DEFINE_EMITS,
DEFINE_PROPS,
type MagicString,
type SFC,
WITH_DEFAULTS,
babelParse,
isCallOf,
} from '@vue-macros/common'
import { type MagicString, type SFC } from '@vue-macros/common'
import { type CallExpression, type LVal, type Node } from '@babel/types'
import { type TSFile } from '../ts'
import { handleTSPropsDefinition } from './props'
import { handleTSEmitsDefinition } from './emits'
import { type Emits } from './emits'
import {
type DefaultsASTRaw,
type DefinePropsStatement,
type Props,
handleTSPropsDefinition,
} from './props'
import { type Emits, handleTSEmitsDefinition } from './emits'

export type { SFC } from '@vue-macros/common'
export { parseSFC } from '@vue-macros/common'
Expand Down
9 changes: 5 additions & 4 deletions packages/api/src/vue/emits.ts
@@ -1,9 +1,10 @@
import {
type MagicString,
type SFC,
babelParse,
isStaticExpression,
resolveLiteral,
} from '@vue-macros/common'
import { type MagicString, type SFC } from '@vue-macros/common'
import {
type CallExpression,
type ExpressionStatement,
Expand All @@ -20,16 +21,16 @@ import {
type VariableDeclaration,
} from '@babel/types'
import {
type TSFile,
type TSResolvedType,
isTSExports,
resolveTSProperties,
resolveTSReferencedType,
resolveTSScope,
} from '../ts'
import { keyToString } from '../utils'
import { type TSFile, type TSResolvedType } from '../ts'
import { DefinitionKind } from './types'
import { type ASTDefinition, DefinitionKind } from './types'
import { attachNodeLoc } from './utils'
import { type ASTDefinition } from './types'

export async function handleTSEmitsDefinition({
s,
Expand Down
9 changes: 5 additions & 4 deletions packages/api/src/vue/props.ts
@@ -1,9 +1,10 @@
import {
type MagicString,
type SFC,
babelParse,
isStaticObjectKey,
resolveObjectExpression,
} from '@vue-macros/common'
import { type MagicString, type SFC } from '@vue-macros/common'
import {
type CallExpression,
type Expression,
Expand All @@ -24,16 +25,16 @@ import {
type VariableDeclaration,
} from '@babel/types'
import {
type TSFile,
type TSResolvedType,
isTSExports,
resolveTSProperties,
resolveTSReferencedType,
resolveTSScope,
} from '../ts'
import { keyToString } from '../utils'
import { type TSFile, type TSResolvedType } from '../ts'
import { DefinitionKind } from './types'
import { type ASTDefinition, DefinitionKind } from './types'
import { attachNodeLoc, inferRuntimeType } from './utils'
import { type ASTDefinition } from './types'

export async function handleTSPropsDefinition({
s,
Expand Down
8 changes: 6 additions & 2 deletions packages/api/src/vue/utils.ts
@@ -1,6 +1,10 @@
import { type Node } from '@babel/types'
import { isTSExports, resolveTSReferencedType } from '../ts'
import { type TSExports, type TSResolvedType } from '../ts'
import {
type TSExports,
type TSResolvedType,
isTSExports,
resolveTSReferencedType,
} from '../ts'

export async function inferRuntimeType(
node: TSResolvedType | TSExports
Expand Down
2 changes: 1 addition & 1 deletion packages/api/tests/ts.test.ts
Expand Up @@ -7,12 +7,12 @@ import {
type TSTypeAliasDeclaration,
} from '@babel/types'
import {
type TSFile,
getTSFile,
resolveTSExports,
resolveTSProperties,
resolveTSReferencedType,
} from '../src'
import { type TSFile } from '../src'
import { hideAstLocation } from './_util'

const fixtures = path.resolve(__dirname, 'fixtures')
Expand Down
8 changes: 6 additions & 2 deletions packages/better-define/src/core/index.ts
Expand Up @@ -4,8 +4,12 @@ import {
importHelperFn,
parseSFC,
} from '@vue-macros/common'
import { analyzeSFC, toRuntimeTypeString } from '@vue-macros/api'
import { type TSEmits, type TSProps } from '@vue-macros/api'
import {
type TSEmits,
type TSProps,
analyzeSFC,
toRuntimeTypeString,
} from '@vue-macros/api'

export async function transformBetterDefine(
code: string,
Expand Down
3 changes: 2 additions & 1 deletion packages/better-define/src/index.ts
@@ -1,13 +1,14 @@
import { createUnplugin } from 'unplugin'
import {
type BaseOptions,
type MarkRequired,
REGEX_SETUP_SFC,
REGEX_VUE_SFC,
REGEX_VUE_SUB,
createFilter,
detectVueVersion,
} from '@vue-macros/common'
import { RollupResolve, setResolveTSFileIdImpl } from '@vue-macros/api'
import { type BaseOptions, type MarkRequired } from '@vue-macros/common'
import { type PluginContext } from 'rollup'
import { transformBetterDefine } from './core'

Expand Down
6 changes: 4 additions & 2 deletions packages/common/src/unplugin.ts
@@ -1,6 +1,8 @@
import { createFilter as createRollupFilter } from '@rollup/pluginutils'
import {
type FilterPattern,
createFilter as createRollupFilter,
} from '@rollup/pluginutils'
import { type MagicStringBase } from 'magic-string-ast'
import { type FilterPattern } from '@rollup/pluginutils'

export function getTransformResult(
s: MagicStringBase | undefined,
Expand Down
6 changes: 3 additions & 3 deletions packages/common/src/vue.ts
@@ -1,11 +1,11 @@
import { parse } from '@vue/compiler-sfc'
import { type Program } from '@babel/types'
import { type MagicStringBase } from 'magic-string-ast'
import {
type SFCDescriptor,
type SFCParseResult,
type SFCScriptBlock as SFCScriptBlockMixed,
parse,
} from '@vue/compiler-sfc'
import { type Program } from '@babel/types'
import { type MagicStringBase } from 'magic-string-ast'
import { babelParse } from './ast'
import { getLang } from './lang'
import { REGEX_VUE_SFC } from './constants'
Expand Down
3 changes: 2 additions & 1 deletion packages/define-emit/src/index.ts
@@ -1,5 +1,7 @@
import { createUnplugin } from 'unplugin'
import {
type BaseOptions,
type MarkRequired,
REGEX_SETUP_SFC,
REGEX_VUE_SFC,
REGEX_VUE_SUB,
Expand All @@ -8,7 +10,6 @@ import {
} from '@vue-macros/common'
import { RollupResolve, setResolveTSFileIdImpl } from '@vue-macros/api'
import { type PluginContext } from 'rollup'
import { type BaseOptions, type MarkRequired } from '@vue-macros/common'
import { transformDefineEmit } from './core'

export interface Options extends BaseOptions {
Expand Down
6 changes: 2 additions & 4 deletions packages/define-models/src/core/helper/use-vmodel.ts
@@ -1,7 +1,5 @@
import { getCurrentInstance } from 'vue'
import { useVModel } from '@vueuse/core'
import { type UseVModelOptions } from '@vueuse/core'
import { type Ref } from 'vue'
import { type Ref, getCurrentInstance } from 'vue'
import { type UseVModelOptions, useVModel } from '@vueuse/core'

// eslint-disable-next-line import/no-default-export
export default (
Expand Down
3 changes: 2 additions & 1 deletion packages/define-models/src/index.ts
@@ -1,13 +1,14 @@
import { createUnplugin } from 'unplugin'
import {
type BaseOptions,
type MarkRequired,
REGEX_SETUP_SFC,
REGEX_VUE_SFC,
REGEX_VUE_SUB,
createFilter,
detectVueVersion,
normalizePath,
} from '@vue-macros/common'
import { type BaseOptions, type MarkRequired } from '@vue-macros/common'
import { transformDefineModels } from './core'
import {
emitHelperCode,
Expand Down
3 changes: 2 additions & 1 deletion packages/define-options/src/index.ts
@@ -1,12 +1,13 @@
import { createUnplugin } from 'unplugin'
import {
type BaseOptions,
type MarkRequired,
REGEX_SETUP_SFC,
REGEX_VUE_SFC,
REGEX_VUE_SUB,
createFilter,
detectVueVersion,
} from '@vue-macros/common'
import { type BaseOptions, type MarkRequired } from '@vue-macros/common'
import { transformDefineOptions } from './core/transform'

export type Options = BaseOptions
Expand Down
6 changes: 3 additions & 3 deletions packages/define-prop/src/index.ts
@@ -1,5 +1,7 @@
import { createUnplugin } from 'unplugin'
import {
type BaseOptions,
type MarkRequired,
REGEX_SETUP_SFC,
REGEX_VUE_SFC,
REGEX_VUE_SUB,
Expand All @@ -8,9 +10,7 @@ import {
} from '@vue-macros/common'
import { RollupResolve, setResolveTSFileIdImpl } from '@vue-macros/api'
import { type PluginContext } from 'rollup'
import { type BaseOptions, type MarkRequired } from '@vue-macros/common'
import { type Edition } from './core'
import { transformDefineProp } from './core'
import { type Edition, transformDefineProp } from './core'

export interface Options extends BaseOptions {
isProduction?: boolean
Expand Down
@@ -1,7 +1,6 @@
<script setup lang="ts">
import { expectTypeOf } from 'expect-type'
import type { ComputedRef } from 'vue'
import type { Qux } from '../types'
import { defineProp } from '../../../macros-johnson'
// defineProp()
Expand Down
3 changes: 2 additions & 1 deletion packages/define-props-refs/src/index.ts
@@ -1,12 +1,13 @@
import { createUnplugin } from 'unplugin'
import {
type BaseOptions,
type MarkRequired,
REGEX_SETUP_SFC,
REGEX_VUE_SFC,
REGEX_VUE_SUB,
createFilter,
detectVueVersion,
} from '@vue-macros/common'
import { type BaseOptions, type MarkRequired } from '@vue-macros/common'
import { transformDefinePropsRefs } from './core/index'

export { transformDefinePropsRefs } from './core'
Expand Down
3 changes: 2 additions & 1 deletion packages/define-props/src/index.ts
@@ -1,12 +1,13 @@
import { createUnplugin } from 'unplugin'
import {
type BaseOptions,
type MarkRequired,
REGEX_SETUP_SFC,
REGEX_VUE_SFC,
REGEX_VUE_SUB,
createFilter,
detectVueVersion,
} from '@vue-macros/common'
import { type BaseOptions, type MarkRequired } from '@vue-macros/common'
import { transformDefineProps } from './core'

export { transformDefineProps } from './core'
Expand Down
3 changes: 2 additions & 1 deletion packages/define-render/src/index.ts
@@ -1,11 +1,12 @@
import { createUnplugin } from 'unplugin'
import {
type BaseOptions,
type MarkRequired,
REGEX_SETUP_SFC,
REGEX_VUE_SFC,
createFilter,
detectVueVersion,
} from '@vue-macros/common'
import { type BaseOptions, type MarkRequired } from '@vue-macros/common'
import { transformDefineRender } from './core'

export type Options = BaseOptions
Expand Down
3 changes: 2 additions & 1 deletion packages/define-slots/src/index.ts
@@ -1,12 +1,13 @@
import { createUnplugin } from 'unplugin'
import {
type BaseOptions,
type MarkRequired,
REGEX_SETUP_SFC,
REGEX_VUE_SFC,
REGEX_VUE_SUB,
createFilter,
detectVueVersion,
} from '@vue-macros/common'
import { type BaseOptions, type MarkRequired } from '@vue-macros/common'
import { transformDefineSlots } from './core'

export type Options = BaseOptions
Expand Down
3 changes: 2 additions & 1 deletion packages/export-props/src/index.ts
@@ -1,12 +1,13 @@
import { createUnplugin } from 'unplugin'
import {
type BaseOptions,
type MarkRequired,
REGEX_SETUP_SFC,
REGEX_VUE_SFC,
REGEX_VUE_SUB,
createFilter,
detectVueVersion,
} from '@vue-macros/common'
import { type BaseOptions, type MarkRequired } from '@vue-macros/common'
import { transformExportProps } from './core'

export { transformExportProps as transformDefineProps } from './core'
Expand Down
3 changes: 2 additions & 1 deletion packages/hoist-static/src/index.ts
@@ -1,12 +1,13 @@
import { createUnplugin } from 'unplugin'
import {
type BaseOptions,
type MarkRequired,
REGEX_SETUP_SFC,
REGEX_VUE_SFC,
REGEX_VUE_SUB,
createFilter,
detectVueVersion,
} from '@vue-macros/common'
import { type BaseOptions, type MarkRequired } from '@vue-macros/common'
import { transformHoistStatic } from './core'

export type Options = BaseOptions
Expand Down

0 comments on commit 1bacbc9

Please sign in to comment.