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 Jun 12, 2023
1 parent a533bfb commit 111cea5
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 31 deletions.
9 changes: 0 additions & 9 deletions .eslintrc.js

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -3,3 +3,4 @@ node_modules
dist
*.log
.vercel
.eslintcache
6 changes: 5 additions & 1 deletion .vscode/settings.json
@@ -1,3 +1,7 @@
{
"editor.formatOnSave": true
"editor.formatOnSave": true,
"eslint.experimental.useFlatConfig": true,
"eslint.options": {
"overrideConfigFile": "./eslint.config.mjs"
}
}
3 changes: 3 additions & 0 deletions eslint.config.mjs
@@ -0,0 +1,3 @@
import { sxzz } from '@sxzz/eslint-config'

export default sxzz()
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -65,7 +65,7 @@
"access": "public"
},
"scripts": {
"lint": "eslint . --ext .vue,.js,.ts,.jsx,.tsx,.json,.md",
"lint": "ESLINT_USE_FLAT_CONFIG=true eslint -c eslint.config.mjs --cache .",
"lint:fix": "pnpm run lint -- --fix",
"build": "tsup && tsx scripts/postbuild.mts",
"test": "vitest",
Expand Down
6 changes: 3 additions & 3 deletions scripts/postbuild.mts
@@ -1,6 +1,6 @@
import { basename, dirname, resolve } from 'path'
import { readFile, writeFile } from 'fs/promises'
import { fileURLToPath } from 'url'
import { basename, dirname, resolve } from 'node:path'
import { readFile, writeFile } from 'node:fs/promises'
import { fileURLToPath } from 'node:url'
import fg from 'fast-glob'

// fix cjs exports
Expand Down
4 changes: 2 additions & 2 deletions src/core/options.ts
@@ -1,6 +1,6 @@
import { getPackageInfo } from 'local-pkg'
import type { VueJSXPluginOptions } from '@vue/babel-plugin-jsx'
import type { FilterPattern } from '@rollup/pluginutils'
import { type VueJSXPluginOptions } from '@vue/babel-plugin-jsx'
import { type FilterPattern } from '@rollup/pluginutils'

export type Vue2JSXOptions = {
functional?: boolean
Expand Down
5 changes: 2 additions & 3 deletions src/core/vue2.ts
@@ -1,11 +1,10 @@
import { transform } from '@babel/core'
import { type TransformOptions, transform } from '@babel/core'
// @ts-expect-error
import TS from '@babel/plugin-syntax-typescript'
// @ts-expect-error
import vue2Jsx from '@vue/babel-preset-jsx'
import { isTS } from './utils'
import type { TransformOptions } from '@babel/core'
import type { OptionsResolved } from './options'
import { type OptionsResolved } from './options'

export const transformVue2 = (
code: string,
Expand Down
5 changes: 2 additions & 3 deletions src/core/vue3.ts
@@ -1,10 +1,9 @@
import { transform } from '@babel/core'
import { type TransformOptions, transform } from '@babel/core'
import vue3Jsx from '@vue/babel-plugin-jsx'
// @ts-expect-error
import TS from '@babel/plugin-syntax-typescript'
import { isTS } from './utils'
import type { TransformOptions } from '@babel/core'
import type { OptionsResolved } from './options'
import { type OptionsResolved } from './options'

export const transformVue3 = (
code: string,
Expand Down
10 changes: 6 additions & 4 deletions src/index.ts
@@ -1,8 +1,10 @@
import { createUnplugin } from 'unplugin'
import { type UnpluginOptions, createUnplugin } from 'unplugin'
import { createFilter } from '@rollup/pluginutils'
import { resolveOption } from './core/options'
import type { UnpluginOptions } from 'unplugin'
import type { Options, OptionsResolved } from './core/options'
import {
type Options,
type OptionsResolved,
resolveOption,
} from './core/options'

export default createUnplugin<Options>((userOptions = {}) => {
let options: OptionsResolved
Expand Down
2 changes: 1 addition & 1 deletion src/vite.ts
@@ -1,4 +1,4 @@
import unplugin from '.'
import type {} from 'vite'
import {} from 'vite'

export default unplugin.vite
3 changes: 1 addition & 2 deletions tests/vue2.test.ts
@@ -1,7 +1,6 @@
import { describe, expect, test } from 'vitest'
import { resolveOption } from '../src/core/options'
import { type Options, resolveOption } from '../src/core/options'
import { transformVue2 } from '../src/core/vue2'
import type { Options } from '../src/core/options'

const transform = async (code: string, userOptions: Options = {}) => {
const options = await resolveOption({
Expand Down
3 changes: 1 addition & 2 deletions tests/vue3.test.ts
@@ -1,7 +1,6 @@
import { describe, expect, test } from 'vitest'
import { resolveOption } from '../src/core/options'
import { type Options, resolveOption } from '../src/core/options'
import { transformVue3 } from '../src/core/vue3'
import type { Options } from '../src/core/options'

const transform = async (
code: string,
Expand Down

0 comments on commit 111cea5

Please sign in to comment.