summaryrefslogtreecommitdiff
path: root/packages/client/src/components/ui
diff options
context:
space:
mode:
authorJohann150 <johann.galle@protonmail.com>2022-05-26 15:53:09 +0200
committerGitHub <noreply@github.com>2022-05-26 22:53:09 +0900
commit3dae18b93cc2a219087c4e1a8acc763ff064b71d (patch)
treeee00206569ab940f7e1af154452123567c4d92f8 /packages/client/src/components/ui
parentuse http-signature module that supports hs2019 (#8635) (diff)
downloadsharkey-3dae18b93cc2a219087c4e1a8acc763ff064b71d.tar.gz
sharkey-3dae18b93cc2a219087c4e1a8acc763ff064b71d.tar.bz2
sharkey-3dae18b93cc2a219087c4e1a8acc763ff064b71d.zip
fix lints (#8737)
* fix: emits use ev instead of e * fix: errors use err instead of e * fix: replace use of data where possible * fix: events use evt instead of e * fix: use strict equals * fix: use emoji instead of e * fix: vue lints
Diffstat (limited to 'packages/client/src/components/ui')
-rw-r--r--packages/client/src/components/ui/button.vue14
-rw-r--r--packages/client/src/components/ui/context-menu.vue6
-rw-r--r--packages/client/src/components/ui/menu.vue2
-rw-r--r--packages/client/src/components/ui/modal-window.vue8
-rw-r--r--packages/client/src/components/ui/pagination.vue8
-rw-r--r--packages/client/src/components/ui/popup-menu.vue2
-rw-r--r--packages/client/src/components/ui/window.vue54
7 files changed, 47 insertions, 47 deletions
diff --git a/packages/client/src/components/ui/button.vue b/packages/client/src/components/ui/button.vue
index c7b6c8ba96..fe8f1c7cca 100644
--- a/packages/client/src/components/ui/button.vue
+++ b/packages/client/src/components/ui/button.vue
@@ -90,7 +90,7 @@ export default defineComponent({
}
},
methods: {
- onMousedown(e: MouseEvent) {
+ onMousedown(evt: MouseEvent) {
function distance(p, q) {
return Math.hypot(p.x - q.x, p.y - q.y);
}
@@ -104,18 +104,18 @@ export default defineComponent({
return Math.max(dist1, dist2, dist3, dist4) * 2;
}
- const rect = e.target.getBoundingClientRect();
+ const rect = evt.target.getBoundingClientRect();
const ripple = document.createElement('div');
- ripple.style.top = (e.clientY - rect.top - 1).toString() + 'px';
- ripple.style.left = (e.clientX - rect.left - 1).toString() + 'px';
+ ripple.style.top = (evt.clientY - rect.top - 1).toString() + 'px';
+ ripple.style.left = (evt.clientX - rect.left - 1).toString() + 'px';
this.$refs.ripples.appendChild(ripple);
- const circleCenterX = e.clientX - rect.left;
- const circleCenterY = e.clientY - rect.top;
+ const circleCenterX = evt.clientX - rect.left;
+ const circleCenterY = evt.clientY - rect.top;
- const scale = calcCircleScale(e.target.clientWidth, e.target.clientHeight, circleCenterX, circleCenterY);
+ const scale = calcCircleScale(evt.target.clientWidth, evt.target.clientHeight, circleCenterX, circleCenterY);
window.setTimeout(() => {
ripple.style.transform = 'scale(' + (scale / 2) + ')';
diff --git a/packages/client/src/components/ui/context-menu.vue b/packages/client/src/components/ui/context-menu.vue
index f491b43b46..e637d361cf 100644
--- a/packages/client/src/components/ui/context-menu.vue
+++ b/packages/client/src/components/ui/context-menu.vue
@@ -19,7 +19,7 @@ const props = defineProps<{
}>();
const emit = defineEmits<{
- (e: 'closed'): void;
+ (ev: 'closed'): void;
}>();
let rootEl = $ref<HTMLDivElement>();
@@ -63,8 +63,8 @@ onBeforeUnmount(() => {
}
});
-function onMousedown(e: Event) {
- if (!contains(rootEl, e.target) && (rootEl != e.target)) emit('closed');
+function onMousedown(evt: Event) {
+ if (!contains(rootEl, evt.target) && (rootEl !== evt.target)) emit('closed');
}
</script>
diff --git a/packages/client/src/components/ui/menu.vue b/packages/client/src/components/ui/menu.vue
index a93cc8cda8..ca56048262 100644
--- a/packages/client/src/components/ui/menu.vue
+++ b/packages/client/src/components/ui/menu.vue
@@ -60,7 +60,7 @@ const props = defineProps<{
}>();
const emit = defineEmits<{
- (e: 'close'): void;
+ (ev: 'close'): void;
}>();
let itemsEl = $ref<HTMLDivElement>();
diff --git a/packages/client/src/components/ui/modal-window.vue b/packages/client/src/components/ui/modal-window.vue
index b4b8c2b965..6de29c83fa 100644
--- a/packages/client/src/components/ui/modal-window.vue
+++ b/packages/client/src/components/ui/modal-window.vue
@@ -79,10 +79,10 @@ export default defineComponent({
this.$refs.modal.close();
},
- onKeydown(e) {
- if (e.which === 27) { // Esc
- e.preventDefault();
- e.stopPropagation();
+ onKeydown(evt) {
+ if (evt.which === 27) { // Esc
+ evt.preventDefault();
+ evt.stopPropagation();
this.close();
}
},
diff --git a/packages/client/src/components/ui/pagination.vue b/packages/client/src/components/ui/pagination.vue
index 428a9d0225..c081e06acd 100644
--- a/packages/client/src/components/ui/pagination.vue
+++ b/packages/client/src/components/ui/pagination.vue
@@ -68,7 +68,7 @@ const props = withDefaults(defineProps<{
});
const emit = defineEmits<{
- (e: 'queue', count: number): void;
+ (ev: 'queue', count: number): void;
}>();
type Item = { id: string; [another: string]: unknown; };
@@ -112,7 +112,7 @@ const init = async (): Promise<void> => {
offset.value = res.length;
error.value = false;
fetching.value = false;
- }, e => {
+ }, err => {
error.value = true;
fetching.value = false;
});
@@ -155,7 +155,7 @@ const fetchMore = async (): Promise<void> => {
}
offset.value += res.length;
moreFetching.value = false;
- }, e => {
+ }, err => {
moreFetching.value = false;
});
};
@@ -183,7 +183,7 @@ const fetchMoreAhead = async (): Promise<void> => {
}
offset.value += res.length;
moreFetching.value = false;
- }, e => {
+ }, err => {
moreFetching.value = false;
});
};
diff --git a/packages/client/src/components/ui/popup-menu.vue b/packages/client/src/components/ui/popup-menu.vue
index 8d6c1b5695..2bc7030d77 100644
--- a/packages/client/src/components/ui/popup-menu.vue
+++ b/packages/client/src/components/ui/popup-menu.vue
@@ -19,7 +19,7 @@ defineProps<{
}>();
const emit = defineEmits<{
- (e: 'closed'): void;
+ (ev: 'closed'): void;
}>();
let modal = $ref<InstanceType<typeof MkModal>>();
diff --git a/packages/client/src/components/ui/window.vue b/packages/client/src/components/ui/window.vue
index fa32ecfdef..2066cf579d 100644
--- a/packages/client/src/components/ui/window.vue
+++ b/packages/client/src/components/ui/window.vue
@@ -139,10 +139,10 @@ export default defineComponent({
this.showing = false;
},
- onKeydown(e) {
- if (e.which === 27) { // Esc
- e.preventDefault();
- e.stopPropagation();
+ onKeydown(evt) {
+ if (evt.which === 27) { // Esc
+ evt.preventDefault();
+ evt.stopPropagation();
this.close();
}
},
@@ -162,15 +162,15 @@ export default defineComponent({
this.top();
},
- onHeaderMousedown(e) {
+ onHeaderMousedown(evt) {
const main = this.$el as any;
if (!contains(main, document.activeElement)) main.focus();
const position = main.getBoundingClientRect();
- const clickX = e.touches && e.touches.length > 0 ? e.touches[0].clientX : e.clientX;
- const clickY = e.touches && e.touches.length > 0 ? e.touches[0].clientY : e.clientY;
+ const clickX = evt.touches && evt.touches.length > 0 ? evt.touches[0].clientX : evt.clientX;
+ const clickY = evt.touches && evt.touches.length > 0 ? evt.touches[0].clientY : evt.clientY;
const moveBaseX = clickX - position.left;
const moveBaseY = clickY - position.top;
const browserWidth = window.innerWidth;
@@ -204,10 +204,10 @@ export default defineComponent({
},
// 上ハンドル掴み時
- onTopHandleMousedown(e) {
+ onTopHandleMousedown(evt) {
const main = this.$el as any;
- const base = e.clientY;
+ const base = evt.clientY;
const height = parseInt(getComputedStyle(main, '').height, 10);
const top = parseInt(getComputedStyle(main, '').top, 10);
@@ -230,10 +230,10 @@ export default defineComponent({
},
// 右ハンドル掴み時
- onRightHandleMousedown(e) {
+ onRightHandleMousedown(evt) {
const main = this.$el as any;
- const base = e.clientX;
+ const base = evt.clientX;
const width = parseInt(getComputedStyle(main, '').width, 10);
const left = parseInt(getComputedStyle(main, '').left, 10);
const browserWidth = window.innerWidth;
@@ -254,10 +254,10 @@ export default defineComponent({
},
// 下ハンドル掴み時
- onBottomHandleMousedown(e) {
+ onBottomHandleMousedown(evt) {
const main = this.$el as any;
- const base = e.clientY;
+ const base = evt.clientY;
const height = parseInt(getComputedStyle(main, '').height, 10);
const top = parseInt(getComputedStyle(main, '').top, 10);
const browserHeight = window.innerHeight;
@@ -278,10 +278,10 @@ export default defineComponent({
},
// 左ハンドル掴み時
- onLeftHandleMousedown(e) {
+ onLeftHandleMousedown(evt) {
const main = this.$el as any;
- const base = e.clientX;
+ const base = evt.clientX;
const width = parseInt(getComputedStyle(main, '').width, 10);
const left = parseInt(getComputedStyle(main, '').left, 10);
@@ -304,27 +304,27 @@ export default defineComponent({
},
// 左上ハンドル掴み時
- onTopLeftHandleMousedown(e) {
- this.onTopHandleMousedown(e);
- this.onLeftHandleMousedown(e);
+ onTopLeftHandleMousedown(evt) {
+ this.onTopHandleMousedown(evt);
+ this.onLeftHandleMousedown(evt);
},
// 右上ハンドル掴み時
- onTopRightHandleMousedown(e) {
- this.onTopHandleMousedown(e);
- this.onRightHandleMousedown(e);
+ onTopRightHandleMousedown(evt) {
+ this.onTopHandleMousedown(evt);
+ this.onRightHandleMousedown(evt);
},
// 右下ハンドル掴み時
- onBottomRightHandleMousedown(e) {
- this.onBottomHandleMousedown(e);
- this.onRightHandleMousedown(e);
+ onBottomRightHandleMousedown(evt) {
+ this.onBottomHandleMousedown(evt);
+ this.onRightHandleMousedown(evt);
},
// 左下ハンドル掴み時
- onBottomLeftHandleMousedown(e) {
- this.onBottomHandleMousedown(e);
- this.onLeftHandleMousedown(e);
+ onBottomLeftHandleMousedown(evt) {
+ this.onBottomHandleMousedown(evt);
+ this.onLeftHandleMousedown(evt);
},
// 高さを適用