introduce lint for client

Resolve #7998
This commit is contained in:
syuilo
2021-11-18 23:32:43 +09:00
parent c850cef711
commit 73b5c12927
40 changed files with 817 additions and 153 deletions

View File

@ -31,10 +31,6 @@ export default defineComponent({
},
methods: {
focus() {
this.$slots.default[0].elm.focus();
},
getDateText(time: string) {
const date = new Date(time).getDate();
const month = new Date(time).getMonth() + 1;

View File

@ -128,7 +128,7 @@ export default defineComponent({
type: Boolean,
required: false
},
visibleUsers: {
initialVisibleUsers: {
type: Array,
required: false,
default: () => []
@ -167,6 +167,7 @@ export default defineComponent({
cw: null,
localOnly: this.$store.state.rememberNoteVisibility ? this.$store.state.localOnly : this.$store.state.defaultNoteLocalOnly,
visibility: (this.$store.state.rememberNoteVisibility ? this.$store.state.visibility : this.$store.state.defaultNoteVisibility) as typeof noteVisibilities[number],
visibleUsers: [],
autocomplete: null,
draghover: false,
quoteId: null,
@ -273,6 +274,10 @@ export default defineComponent({
this.localOnly = this.initialLocalOnly;
}
if (this.initialVisibleUsers) {
this.visibleUsers = this.initialVisibleUsers;
}
if (this.mention) {
this.text = this.mention.host ? `@${this.mention.username}@${toASCII(this.mention.host)}` : `@${this.mention.username}`;
this.text += ' ';

View File

@ -33,11 +33,25 @@ export default defineComponent({
ctx: null,
};
},
unmounted() {
window.cancelAnimationFrame(this.anim);
},
mounted() {
this.ctx = this.$refs.canvas.getContext('2d');
new ResizeObserver(this.resize).observe(this.$refs.content);
this.resize();
this.tick();
},
updated() {
this.resize();
},
methods: {
createSparkles(w, h, count) {
var holder = [];
const holder = [];
for (var i = 0; i < count; i++) {
for (let i = 0; i < count; i++) {
const color = '#' + ('000000' + Math.floor(Math.random() * 16777215).toString(16)).slice(-6);
@ -143,20 +157,6 @@ export default defineComponent({
}
},
},
mounted() {
this.ctx = this.$refs.canvas.getContext('2d');
new ResizeObserver(this.resize).observe(this.$refs.content);
this.resize();
this.tick();
},
updated() {
this.resize();
},
destroyed() {
window.cancelAnimationFrame(this.anim);
},
});
</script>

View File

@ -5,7 +5,7 @@
@contextmenu.self="e => e.preventDefault()"
v-hotkey="keymap"
>
<template v-for="(item, i) in _items">
<template v-for="(item, i) in items2">
<div v-if="item === null" class="divider"></div>
<span v-else-if="item.type === 'label'" class="label item">
<span>{{ item.text }}</span>
@ -35,7 +35,7 @@
<span v-if="item.indicate" class="indicator"><i class="fas fa-circle"></i></span>
</button>
</template>
<span v-if="_items.length === 0" class="none item">
<span v-if="items2.length === 0" class="none item">
<span>{{ $ts.none }}</span>
</span>
</div>
@ -68,7 +68,7 @@ export default defineComponent({
emits: ['close'],
data() {
return {
_items: [],
items2: [],
};
},
computed: {
@ -96,7 +96,7 @@ export default defineComponent({
}
}
this._items = items;
this.items2 = items;
},
immediate: true
}

View File

@ -58,6 +58,7 @@ export default defineComponent({
mounted() {
this.$watch('src', () => {
if (this.src) {
// eslint-disable-next-line vue/no-mutating-props
this.src.style.pointerEvents = 'none';
}
this.fixed = getFixedContainer(this.src) != null;
@ -159,6 +160,7 @@ export default defineComponent({
},
close() {
// eslint-disable-next-line vue/no-mutating-props
if (this.src) this.src.style.pointerEvents = 'auto';
this.showing = false;
this.$emit('close');