style: update eslint config and fix code lint

This commit is contained in:
pengzhanbo 2023-10-11 04:32:15 +08:00
parent 1808946143
commit e29d431dfd
10 changed files with 17 additions and 28 deletions

View File

@ -13,9 +13,7 @@ export type FrontmatterFn<T = any, K = object> = (
data: K
) => T | PromiseLike<T>
export type FrontmatterObject<K = object, T = any> = {
[P: string]: FrontmatterFn<T, K>
}
export type FrontmatterObject<K = object, T = any> = Record<string, FrontmatterFn<T, K>>;
export type FrontmatterArray = {
include: string | string[]

View File

@ -1,7 +1,6 @@
export const resolveCanIUse = (): void => {
const canIUseEls = document.getElementsByClassName('ciu_embed')
for (let t = 0; t < canIUseEls.length; t++) {
const el = canIUseEls[t]
const canIUseEls = Array.from(document.getElementsByClassName('ciu_embed'))
for (const el of canIUseEls) {
const feature = el.getAttribute('data-feature')
const periods = el.getAttribute('data-periods')
const accessible = el.getAttribute('data-accessible-colours') || 'false'
@ -18,8 +17,7 @@ export const resolveCanIUse = (): void => {
const data = message.data
if (typeof data === 'string' && data.indexOf('ciu_embed') > -1) {
const [, feature, height] = data.split(':')
for (let i = 0; i < canIUseEls.length; i++) {
const el = canIUseEls[i]
for (const el of canIUseEls) {
if (el.getAttribute('data-feature') === feature) {
const h = parseInt(height) + 30
;(el.childNodes[0] as any).height = h + 'px'

View File

@ -1,4 +1,4 @@
export type NotesDataOptions = {
export interface NotesDataOptions {
dir: string
link: string
include?: string | string[]
@ -6,7 +6,7 @@ export type NotesDataOptions = {
notes: NotesItem[]
}
export type NotesItem = {
export interface NotesItem {
dir: string
link: string
text: string
@ -15,7 +15,7 @@ export type NotesItem = {
export type NotesSidebar = (NotesSidebarItem | string)[]
export type NotesSidebarItem = {
export interface NotesSidebarItem {
text?: string
link?: string
dir?: string

View File

@ -1,3 +1 @@
export interface PageCollectionOptions {
[x: string]: unknown
}
export type PageCollectionOptions = Record<string, unknown>;

View File

@ -6,9 +6,7 @@ defineProps<{
open: boolean
}>()
defineEmits<{
(e: 'open-menu'): void
}>()
defineEmits<(e: 'open-menu') => void>()
const { hasSidebar } = useSidebar()

View File

@ -14,9 +14,7 @@ import NavBarTranslations from './NavBarTranslations.vue'
defineProps<{
isScreenOpen: boolean
}>()
defineEmits<{
(e: 'toggle-screen'): void
}>()
defineEmits<(e: 'toggle-screen') => void>()
const { y } = useWindowScroll()
const { hasSidebar } = useSidebar()

View File

@ -3,9 +3,7 @@ defineProps<{
active: boolean
}>()
defineEmits<{
(e: 'click'): void
}>()
defineEmits<(e: 'click') => void>()
</script>
<template>

View File

@ -1,4 +1,5 @@
import { onUnmounted, readonly, ref, type Ref, watch } from 'vue'
import { onUnmounted, readonly, ref, watch } from 'vue'
import type {Ref} from 'vue';
import { inBrowser } from '../utils/index.js'
interface UseFlyoutOptions {

View File

@ -1,6 +1,6 @@
export type NavItem = NavItemWithLink | NavItemWithChildren
export type NavItemWithLink = {
export interface NavItemWithLink {
text: string
link: string
icon?: string
@ -12,7 +12,7 @@ export type NavItemWithLink = {
activeMatch?: string
}
export type NavItemChildren = {
export interface NavItemChildren {
text?: string
icon?: string
items: NavItemWithLink[]

View File

@ -1,4 +1,4 @@
export type PlumeThemePageData = {
export interface PlumeThemePageData {
git: {
createTime: number
updateTime: number
@ -8,7 +8,7 @@ export type PlumeThemePageData = {
categoryList?: PageCategoryData[]
}
export type PageCategoryData = {
export interface PageCategoryData {
type: string | number
name: string
}