fix(client): fix lint issues in Deck UI components (#8681)

This commit is contained in:
Andreas Nedbal 2022-05-19 10:35:43 +02:00 committed by GitHub
parent 3d46da64a8
commit a273940348
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 34 additions and 34 deletions

View File

@ -22,8 +22,8 @@ const props = defineProps<{
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'loaded'): void; (ev: 'loaded'): void;
(e: 'parent-focus', direction: 'up' | 'down' | 'left' | 'right'): void; (ev: 'parent-focus', direction: 'up' | 'down' | 'left' | 'right'): void;
}>(); }>();
let timeline = $ref<InstanceType<typeof XTimeline>>(); let timeline = $ref<InstanceType<typeof XTimeline>>();

View File

@ -29,7 +29,7 @@ defineProps<{
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'parent-focus', direction: 'up' | 'down' | 'left' | 'right'): void; (ev: 'parent-focus', direction: 'up' | 'down' | 'left' | 'right'): void;
}>(); }>();
/* /*

View File

@ -61,8 +61,8 @@ const props = withDefaults(defineProps<{
}); });
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'parent-focus', direction: 'up' | 'down' | 'left' | 'right'): void; (ev: 'parent-focus', direction: 'up' | 'down' | 'left' | 'right'): void;
(e: 'change-active-state', v: boolean): void; (ev: 'change-active-state', v: boolean): void;
}>(); }>();
let body = $ref<HTMLDivElement>(); let body = $ref<HTMLDivElement>();
@ -193,9 +193,9 @@ function goTop() {
}); });
} }
function onDragstart(e) { function onDragstart(ev) {
e.dataTransfer.effectAllowed = 'move'; ev.dataTransfer.effectAllowed = 'move';
e.dataTransfer.setData(_DATA_TRANSFER_DECK_COLUMN_, props.column.id); ev.dataTransfer.setData(_DATA_TRANSFER_DECK_COLUMN_, props.column.id);
// ChromeDragstartDOM(=)Drag // ChromeDragstartDOM(=)Drag
// SEE: https://stackoverflow.com/questions/19639969/html5-dragend-event-firing-immediately // SEE: https://stackoverflow.com/questions/19639969/html5-dragend-event-firing-immediately
@ -204,21 +204,21 @@ function onDragstart(e) {
}, 10); }, 10);
} }
function onDragend(e) { function onDragend(ev) {
dragging = false; dragging = false;
} }
function onDragover(e) { function onDragover(ev) {
// //
if (dragging) { if (dragging) {
// //
e.dataTransfer.dropEffect = 'none'; ev.dataTransfer.dropEffect = 'none';
return; return;
} }
const isDeckColumn = e.dataTransfer.types[0] == _DATA_TRANSFER_DECK_COLUMN_; const isDeckColumn = ev.dataTransfer.types[0] === _DATA_TRANSFER_DECK_COLUMN_;
e.dataTransfer.dropEffect = isDeckColumn ? 'move' : 'none'; ev.dataTransfer.dropEffect = isDeckColumn ? 'move' : 'none';
if (!dragging && isDeckColumn) draghover = true; if (!dragging && isDeckColumn) draghover = true;
} }
@ -227,12 +227,12 @@ function onDragleave() {
draghover = false; draghover = false;
} }
function onDrop(e) { function onDrop(ev) {
draghover = false; draghover = false;
os.deckGlobalEvents.emit('column.dragEnd'); os.deckGlobalEvents.emit('column.dragEnd');
const id = e.dataTransfer.getData(_DATA_TRANSFER_DECK_COLUMN_); const id = ev.dataTransfer.getData(_DATA_TRANSFER_DECK_COLUMN_);
if (id != null && id != '') { if (id != null && id !== '') {
swapColumn(props.column.id, id); swapColumn(props.column.id, id);
} }
} }

View File

@ -72,8 +72,8 @@ export const loadDeck = async () => {
scope: ['client', 'deck', 'profiles'], scope: ['client', 'deck', 'profiles'],
key: deckStore.state.profile, key: deckStore.state.profile,
}); });
} catch (e) { } catch (err) {
if (e.code === 'NO_SUCH_KEY') { if (err.code === 'NO_SUCH_KEY') {
// 後方互換性のため // 後方互換性のため
if (deckStore.state.profile === 'default') { if (deckStore.state.profile === 'default') {
saveDeck(); saveDeck();
@ -94,7 +94,7 @@ export const loadDeck = async () => {
deckStore.set('layout', [['a'], ['b']]); deckStore.set('layout', [['a'], ['b']]);
return; return;
} }
throw e; throw err;
} }
deckStore.set('columns', deck.columns); deckStore.set('columns', deck.columns);
@ -114,7 +114,7 @@ export const saveDeck = throttle(1000, () => {
}); });
export function addColumn(column: Column) { export function addColumn(column: Column) {
if (column.name == undefined) column.name = null; if (column.name === undefined) column.name = null;
deckStore.push('columns', column); deckStore.push('columns', column);
deckStore.push('layout', [column.id]); deckStore.push('layout', [column.id]);
saveDeck(); saveDeck();
@ -129,10 +129,10 @@ export function removeColumn(id: Column['id']) {
} }
export function swapColumn(a: Column['id'], b: Column['id']) { export function swapColumn(a: Column['id'], b: Column['id']) {
const aX = deckStore.state.layout.findIndex(ids => ids.indexOf(a) != -1); const aX = deckStore.state.layout.findIndex(ids => ids.indexOf(a) !== -1);
const aY = deckStore.state.layout[aX].findIndex(id => id == a); const aY = deckStore.state.layout[aX].findIndex(id => id === a);
const bX = deckStore.state.layout.findIndex(ids => ids.indexOf(b) != -1); const bX = deckStore.state.layout.findIndex(ids => ids.indexOf(b) !== -1);
const bY = deckStore.state.layout[bX].findIndex(id => id == b); const bY = deckStore.state.layout[bX].findIndex(id => id === b);
const layout = copy(deckStore.state.layout); const layout = copy(deckStore.state.layout);
layout[aX][aY] = b; layout[aX][aY] = b;
layout[bX][bY] = a; layout[bX][bY] = a;
@ -259,7 +259,7 @@ export function removeColumnWidget(id: Column['id'], widget: ColumnWidget) {
const columnIndex = deckStore.state.columns.findIndex(c => c.id === id); const columnIndex = deckStore.state.columns.findIndex(c => c.id === id);
const column = copy(deckStore.state.columns[columnIndex]); const column = copy(deckStore.state.columns[columnIndex]);
if (column == null) return; if (column == null) return;
column.widgets = column.widgets.filter(w => w.id != widget.id); column.widgets = column.widgets.filter(w => w.id !== widget.id);
columns[columnIndex] = column; columns[columnIndex] = column;
deckStore.set('columns', columns); deckStore.set('columns', columns);
saveDeck(); saveDeck();

View File

@ -18,7 +18,7 @@ defineProps<{
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'parent-focus', direction: 'up' | 'down' | 'left' | 'right'): void; (ev: 'parent-focus', direction: 'up' | 'down' | 'left' | 'right'): void;
}>(); }>();
const pagination = { const pagination = {

View File

@ -22,8 +22,8 @@ const props = defineProps<{
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'loaded'): void; (ev: 'loaded'): void;
(e: 'parent-focus', direction: 'up' | 'down' | 'left' | 'right'): void; (ev: 'parent-focus', direction: 'up' | 'down' | 'left' | 'right'): void;
}>(); }>();
let timeline = $ref<InstanceType<typeof XTimeline>>(); let timeline = $ref<InstanceType<typeof XTimeline>>();

View File

@ -35,7 +35,7 @@ defineProps<{
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'parent-focus', direction: 'up' | 'down' | 'left' | 'right'): void; (ev: 'parent-focus', direction: 'up' | 'down' | 'left' | 'right'): void;
}>(); }>();
let pageInfo = $ref<Record<string, any> | null>(null); let pageInfo = $ref<Record<string, any> | null>(null);

View File

@ -18,7 +18,7 @@ defineProps<{
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'parent-focus', direction: 'up' | 'down' | 'left' | 'right'): void; (ev: 'parent-focus', direction: 'up' | 'down' | 'left' | 'right'): void;
}>(); }>();
const pagination = { const pagination = {

View File

@ -20,7 +20,7 @@ const props = defineProps<{
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'parent-focus', direction: 'up' | 'down' | 'left' | 'right'): void; (ev: 'parent-focus', direction: 'up' | 'down' | 'left' | 'right'): void;
}>(); }>();
function func() { function func() {

View File

@ -35,8 +35,8 @@ const props = defineProps<{
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'loaded'): void; (ev: 'loaded'): void;
(e: 'parent-focus', direction: 'up' | 'down' | 'left' | 'right'): void; (ev: 'parent-focus', direction: 'up' | 'down' | 'left' | 'right'): void;
}>(); }>();
let disabled = $ref(false); let disabled = $ref(false);

View File

@ -20,7 +20,7 @@ const props = defineProps<{
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'parent-focus', direction: 'up' | 'down' | 'left' | 'right'): void; (ev: 'parent-focus', direction: 'up' | 'down' | 'left' | 'right'): void;
}>(); }>();
let edit = $ref(false); let edit = $ref(false);