Skip to content

Commit 081d153

Browse files
committed
chore: improve lints
1 parent 5952dda commit 081d153

18 files changed

+141
-205
lines changed

.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
demos
2+
*.d.ts
3+
cache

packages/floating-vue/.eslintrc.js renamed to .eslintrc.js

+4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ module.exports = {
2222
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
2323
'comma-dangle': ['error', 'always-multiline'],
2424
'vue/multi-word-component-names': 'off',
25+
'vue/require-default-prop': 'off',
26+
'vue/no-v-html': 'off',
27+
'vue/require-prop-types': 'off',
2528
'vue/html-closing-bracket-newline': [
2629
'error',
2730
{
@@ -48,6 +51,7 @@ module.exports = {
4851
quotes: ['error', 'single', { allowTemplateLiterals: true }],
4952
'@typescript-eslint/no-empty-function': 'off',
5053
indent: 'off',
54+
'@typescript-eslint/no-this-alias': 'off',
5155
},
5256
ignorePatterns: [
5357
'node_modules/',

docs/.eslintrc.js

-25
This file was deleted.

docs/.vitepress/components/GitHubButton.ts

+14-14
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { defineComponent, h } from 'vue'
44
import { hasOwn, hyphenate } from '@vue/shared'
55

66
export default defineComponent({
7-
name: 'github-button',
7+
name: 'GithubButton',
88
props: {
99
href: String,
1010
ariaLabel: String,
@@ -13,18 +13,7 @@ export default defineComponent({
1313
dataColorScheme: String,
1414
dataSize: String,
1515
dataShowCount: String,
16-
dataText: String
17-
},
18-
render: function () {
19-
const props = { ref: '_' }
20-
for (const key in this.$props) {
21-
props[hyphenate(key)] = this.$props[key]
22-
}
23-
return h('span', [
24-
hasOwn(this.$slots, 'default')
25-
? h('a', props, this.$slots.default())
26-
: h('a', props)
27-
])
16+
dataText: String,
2817
},
2918
mounted: function () {
3019
this.paint()
@@ -52,6 +41,17 @@ export default defineComponent({
5241
},
5342
reset: function () {
5443
this.$el.replaceChild(/** @type {HTMLAnchorElement} */ (this.$refs._), this.$el.lastChild)
44+
},
45+
},
46+
render: function () {
47+
const props = { ref: '_' }
48+
for (const key in this.$props) {
49+
props[hyphenate(key)] = this.$props[key]
5550
}
56-
}
51+
return h('span', [
52+
hasOwn(this.$slots, 'default')
53+
? h('a', props, this.$slots.default())
54+
: h('a', props),
55+
])
56+
},
5757
})

docs/.vitepress/components/SubMenuExample.vue

+6-6
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222

2323
<template #popper>
2424
<VMenu
25-
v-for="n in 5"
26-
:key="n"
25+
v-for="m in 5"
26+
:key="m"
2727
placement="right-start"
2828
instant-move
2929
>
3030
<button class="rounded hover:bg-green-100 px-4 py-2">
31-
Option {{ n }} >
31+
Option {{ m }} >
3232
</button>
3333

3434
<template #popper>
@@ -64,13 +64,13 @@
6464

6565
<template #popper>
6666
<VDropdown
67-
v-for="n in 5"
68-
:key="n"
67+
v-for="m in 5"
68+
:key="m"
6969
placement="right-start"
7070
instant-move
7171
>
7272
<button class="rounded hover:bg-green-100 px-4 py-2">
73-
Option {{ n }} >
73+
Option {{ m }} >
7474
</button>
7575

7676
<template #popper>

docs/.vitepress/components/theme-editor/CreateTheme.vue

+15-11
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
<script>
2-
import Button from './Button.vue'
3-
import Input from './Input.vue'
4-
import Modal from './Modal.vue'
2+
import ThemeButton from './ThemeButton.vue'
3+
import ThemeInput from './ThemeInput.vue'
4+
import ThemeModal from './ThemeModal.vue'
55
import { createNewTheme, state } from './state'
66
import { builtinThemes } from './builtin-themes'
77
88
export default {
9-
components: { Modal, Button, Input },
9+
components: {
10+
ThemeModal,
11+
ThemeButton,
12+
ThemeInput,
13+
},
1014
1115
data () {
1216
return {
@@ -42,13 +46,13 @@ export default {
4246
</script>
4347

4448
<template>
45-
<Modal>
49+
<ThemeModal>
4650
<div class="text-lg border-b border-gray-100">
4751
Create theme
4852
</div>
4953

5054
<div class="space-y-2 w-96">
51-
<Input
55+
<ThemeInput
5256
v-model="name"
5357
placeholder="Theme name"
5458
auto-focus
@@ -64,20 +68,20 @@ export default {
6468
</div>
6569

6670
<template #actions>
67-
<Button
71+
<ThemeButton
6872
color="gray"
6973
class="flex-1 p-2"
7074
@click="close()"
7175
>
7276
Cancel
73-
</Button>
77+
</ThemeButton>
7478

75-
<Button
79+
<ThemeButton
7680
class="flex-1 p-2"
7781
@click="createNewTheme()"
7882
>
7983
Create theme
80-
</Button>
84+
</ThemeButton>
8185
</template>
82-
</Modal>
86+
</ThemeModal>
8387
</template>

docs/.vitepress/components/theme-editor/Sandbox.vue

+3-4
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,12 @@ export default {
2525
},
2626
deep: true,
2727
},
28-
'allStyleOutput': {
28+
allStyleOutput: {
2929
handler () {
30-
if (this.style)
31-
this.style.innerHTML = this.allStyleOutput
30+
if (this.style) { this.style.innerHTML = this.allStyleOutput }
3231
},
3332
immediate: true,
34-
}
33+
},
3534
},
3635
3736
mounted () {

docs/.vitepress/components/theme-editor/ThemeEditor.vue

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import ConfigEditor from './ConfigEditor.vue'
1313
import Tabs from './Tabs.vue'
1414
import ThemesExplorer from './ThemesExplorer.vue'
1515
import CreateTheme from './CreateTheme.vue'
16-
import Button from './Button.vue'
16+
import ThemeButton from './ThemeModal.vue'
1717
import { loadValue, storeValue } from './util'
1818
1919
const OUTPUT_TAB_KEY = 'v-tooltip.theme-editor.output-tab'
@@ -29,7 +29,7 @@ export default {
2929
Tabs,
3030
ThemesExplorer,
3131
CreateTheme,
32-
Button,
32+
ThemeButton,
3333
},
3434
3535
data () {
@@ -111,13 +111,13 @@ export default {
111111
<div class="text-gray-500 text-lg">
112112
Select a theme or create a new one to get started
113113
</div>
114-
<Button
114+
<ThemeButton
115115
class="px-4 py-3"
116116
@click="openCreateTheme()"
117117
>
118118
<PlusIcon class="w-4 h-4 mr-2" />
119119
New theme
120-
</Button>
120+
</ThemeButton>
121121
</div>
122122
</div>
123123

@@ -178,14 +178,14 @@ export default {
178178
placement="top-end"
179179
class="h-full"
180180
>
181-
<button
181+
<ThemeButton
182182
v-tooltip="'Settings'"
183183
class="px-4 py-1 h-full hover:bg-green-200"
184184
>
185185
<SettingsIcon
186186
class="w-4 h-4"
187187
/>
188-
</button>
188+
</ThemeButton>
189189

190190
<template #popper>
191191
<div class="flex flex-col space-y-2 text-sm">

docs/.vitepress/components/theme-editor/ThemesExplorer.vue

+12-12
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import SearchIcon from '~icons/lucide/search'
33
import PlusIcon from '~icons/lucide/plus'
44
import MoreVerticalIcon from '~icons/lucide/more-vertical'
55
import Trash2Icon from '~icons/lucide/trash-2'
6-
import Button from './Button.vue'
7-
import Modal from './Modal.vue'
6+
import ThemeButton from './ThemeButton.vue'
7+
import ThemeModal from './ThemeModal.vue'
88
import { mapState, loadTheme, deleteTheme } from './state'
99
1010
export default {
@@ -13,8 +13,8 @@ export default {
1313
PlusIcon,
1414
MoreVerticalIcon,
1515
Trash2Icon,
16-
Button,
17-
Modal,
16+
ThemeButton,
17+
ThemeModal,
1818
},
1919
2020
data () {
@@ -98,7 +98,7 @@ export default {
9898
</button>
9999

100100
<template #popper>
101-
<Button
101+
<ThemeButton
102102
v-close-popper
103103
color="red"
104104
flat
@@ -107,13 +107,13 @@ export default {
107107
>
108108
<Trash2Icon class="w-4 h-4 mr-2" />
109109
Delete
110-
</Button>
110+
</ThemeButton>
111111
</template>
112112
</VDropdown>
113113
</div>
114114
</div>
115115

116-
<Modal
116+
<ThemeModal
117117
v-if="confirmDeleteTheme"
118118
>
119119
<div class="text-lg">
@@ -122,22 +122,22 @@ export default {
122122
</div>
123123

124124
<template #actions>
125-
<Button
125+
<ThemeButton
126126
color="gray"
127127
class="flex-1 p-2"
128128
@click="confirmDeleteTheme = null"
129129
>
130130
Cancel
131-
</Button>
131+
</ThemeButton>
132132

133-
<Button
133+
<ThemeButton
134134
color="red"
135135
class="flex-1 p-2"
136136
@click="deleteTheme()"
137137
>
138138
Delete theme
139-
</Button>
139+
</ThemeButton>
140140
</template>
141-
</Modal>
141+
</ThemeModal>
142142
</div>
143143
</template>

0 commit comments

Comments
 (0)