Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed Oct 31, 2023
1 parent eeed38c commit e87d331
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 20 deletions.
5 changes: 3 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script setup lang="ts">
import { Repl, type SFCOptions } from '@vue/repl'
import Monaco from '@vue/repl/monaco-editor'
import { type ImportMap } from '@/utils/import-map'
import { type UserOptions } from '@/composables/store'
import type { ImportMap } from '@/utils/import-map'
import type { UserOptions } from '@/composables/store'
const loading = ref(true)
const replRef = ref<InstanceType<typeof Repl>>()
Expand Down Expand Up @@ -46,6 +46,7 @@ if (store.pr) {
store.userOptions.styleSource = `https://preview-${store.pr}-element-plus.surge.sh/bundle/index.css`
store.versions.elementPlus = 'preview'
}
// eslint-disable-next-line unicorn/prefer-top-level-await
store.init().then(() => (loading.value = false))
if (!store.pr && store.userOptions.styleSource) {
store.pr = store.userOptions.styleSource.split('-', 2)[1]
Expand Down
4 changes: 2 additions & 2 deletions src/components/Header.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<script setup lang="ts">
import { type Ref } from 'vue'
import { type ReplStore, type VersionKey } from '@/composables/store'
import {
getSupportedEpVersions,
getSupportedTSVersions,
getSupportedVueVersions,
} from '@/utils/dependency'
import type { Ref } from 'vue'
import type { ReplStore, VersionKey } from '@/composables/store'
const appVersion = import.meta.env.APP_VERSION
const replVersion = import.meta.env.REPL_VERSION
Expand Down
7 changes: 4 additions & 3 deletions src/composables/store.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { File, type Store, type StoreState, compileFile } from '@vue/repl'
import { type UnwrapNestedRefs } from 'vue'
import { atou, utoa } from '@/utils/encode'
import { genCdnLink, genImportMap, genVueLink } from '@/utils/dependency'
import { type ImportMap, mergeImportMap } from '@/utils/import-map'
Expand All @@ -8,6 +7,7 @@ import mainCode from '../template/main.vue?raw'
import welcomeCode from '../template/welcome.vue?raw'
import elementPlusCode from '../template/element-plus.js?raw'
import tsconfigCode from '../template/tsconfig.json?raw'
import type { UnwrapNestedRefs } from 'vue'

export interface Initial {
serializedState?: string
Expand Down Expand Up @@ -76,8 +76,8 @@ export const useStore = (initial: Initial) => {
let map: ImportMap = {}
try {
map = JSON.parse(code)
} catch (err) {
console.error(err)
} catch (error) {
console.error(error)
}
return map
})
Expand Down Expand Up @@ -304,6 +304,7 @@ export const useStore = (initial: Initial) => {
if (state.activeFile.filename === filename) {
setActive(APP_FILE)
}
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
delete state.files[filename]
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/template/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"jsx": "preserve",
"target": "ESNext",
"jsx": "preserve",
"module": "ESNext",
"moduleResolution": "Bundler",
"types": ["element-plus/global.d.ts"],
"allowImportingTsExtensions": true,
"types": ["element-plus/global.d.ts"]
"allowJs": true,
"checkJs": true
},
"vueCompilerOptions": {
"target": 3.3
Expand Down
8 changes: 4 additions & 4 deletions src/utils/dependency.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { gte } from 'semver'
import { type Ref } from 'vue'
import { type MaybeRef } from '@vueuse/core'
import { type Versions } from '@/composables/store'
import { type ImportMap } from '@/utils/import-map'
import type { Ref } from 'vue'
import type { MaybeRef } from '@vueuse/core'
import type { Versions } from '@/composables/store'
import type { ImportMap } from '@/utils/import-map'

export interface Dependency {
pkg?: string
Expand Down
6 changes: 3 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"extends": "@vue/tsconfig/tsconfig.dom.json",
"compilerOptions": {
"baseUrl": ".",
"types": [],
"paths": {
"@/*": ["src/*"]
},
"types": [],
"skipLibCheck": true
},
"references": [{ "path": "./tsconfig.vite-config.json" }],
"include": ["src"],
"exclude": ["src/template"],
"references": [{ "path": "./tsconfig.vite-config.json" }]
"exclude": ["src/template"]
}
4 changes: 2 additions & 2 deletions tsconfig.vite-config.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"extends": "@vue/tsconfig/tsconfig.json",
"include": ["vite.config.*", "package.json"],
"compilerOptions": {
"composite": true,
"types": ["node"]
}
},
"include": ["vite.config.*", "package.json"]
}

0 comments on commit e87d331

Please sign in to comment.