Skip to content

Commit

Permalink
Auto-fix linting problems
Browse files Browse the repository at this point in the history
  • Loading branch information
peace-maker committed Dec 23, 2024
1 parent f3f2c4d commit 4f04498
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 20 deletions.
2 changes: 1 addition & 1 deletion web/src/components/Graph.vue
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ onMounted(() => {
function setChartTagOptions(typ: string, active: boolean) {
nextTick(() => {
const sel = chartTags.value;
for (var i = 0; i < sel.length; i++) {
for (let i = 0; i < sel.length; i++) {
if (sel[i].startsWith(`${typ}/`)) {
sel.splice(i--, 1);
}
Expand Down
6 changes: 3 additions & 3 deletions web/src/components/Results.vue
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ onMounted(() => {
});
function checkboxAction() {
let tmp: boolean[] = [];
const tmp: boolean[] = [];
const v = noneSelected.value;
for (let i = 0; i < (streams.result?.Results.length || 0); i++) {
tmp[i] = v;
Expand Down Expand Up @@ -428,15 +428,15 @@ function fetchStreams(forceUpdate = false) {
selected.value = [];
}
function createMarkFromSelection() {
let ids: number[] = [];
const ids: number[] = [];
for (const s of selectedStreams.value) {
ids.push(s.Stream.ID);
}
EventBus.emit("showCreateTagDialog", "mark", "", ids);
}
function markSelectedStreams(tagId: string, value: boolean) {
let ids: number[] = [];
const ids: number[] = [];
for (const s of selectedStreams.value) {
ids.push(s.Stream.ID);
}
Expand Down
4 changes: 2 additions & 2 deletions web/src/components/SearchBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ const queryTimeLimit = computed({
set(val: string | undefined) {
const q = searchBox.value ?? "";
const ltime = analyze(q).ltime;
let old = ltime?.pieces?.value;
const old = ltime?.pieces?.value;
if (old === val) return;
const infix = val ? `ltime:${val}` : "";
if (old === undefined) {
Expand Down Expand Up @@ -344,7 +344,7 @@ function historyUp() {
if (historyIndex.value === -1) {
pendingSearch.value = searchBox.value;
}
let term = getTermAt(historyIndex.value + 1);
const term = getTermAt(historyIndex.value + 1);
if (term == null) {
return;
}
Expand Down
4 changes: 2 additions & 2 deletions web/src/components/Stream.vue
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ const converters = computed(() => store.converters);
const groupedTags = computed(() => store.groupedTags);
const streamTags = computed(() => {
if (stream.stream == null) return {};
let res: { [key: string]: { name: string; color: string }[] } = {
const res: { [key: string]: { name: string; color: string }[] } = {
service: [],
tag: [],
mark: [],
Expand Down Expand Up @@ -455,7 +455,7 @@ const streamIndex = computed(() => {
if (streams.result == null) return null;
const id = streamId.value;
let i = 0;
for (let r of streams.result.Results) {
for (const r of streams.result.Results) {
if (r.Stream.ID == id) return i;
i++;
}
Expand Down
10 changes: 5 additions & 5 deletions web/src/components/StreamData.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const asciiMap = Array.from({ length: 0x100 }, (_, i) => {
});

const inlineAscii = (chunk: Data) => {
let chunkData = atob(chunk.Content);
const chunkData = atob(chunk.Content);
const asciiEscaped = chunkData
.split("")
.map((c) => asciiMap[c.charCodeAt(0)]);
Expand Down Expand Up @@ -133,7 +133,7 @@ const inlineHex = (b64: string) => {
.split("")
.map((char) => char.charCodeAt(0)),
);
var str = ([] as number[]).slice
const str = ([] as number[]).slice
.call(ui8)
.map((i) => i.toString(16).padStart(2, "0"))
.join("");
Expand All @@ -146,7 +146,7 @@ const hexdump = (b64: string) => {
.split("")
.map((char) => char.charCodeAt(0)),
);
var str = ([] as number[]).slice
const str = ([] as number[]).slice
.call(ui8)
.map((i) => i.toString(16).padStart(2, "0"))
.join("")
Expand All @@ -157,12 +157,12 @@ const hexdump = (b64: string) => {
while (str.length < 48) {
str += " ";
}
var ascii =
let ascii =
str
.replace(/ /g, "")
.match(/.{1,2}/g)
?.map(function (ch) {
var c = String.fromCharCode(parseInt(ch, 16));
let c = String.fromCharCode(parseInt(ch, 16));
if (!/[ -~]/.test(c)) {
c = ".";
}
Expand Down
24 changes: 18 additions & 6 deletions web/src/lib/colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,34 @@ export function randomColor(): string {
const t = v * (1 - (1 - f) * s);
switch (i % 6) {
case 0:
(r = v), (g = t), (b = p);
r = v;
g = t;
b = p;
break;
case 1:
(r = q), (g = v), (b = p);
r = q;
g = v;
b = p;
break;
case 2:
(r = p), (g = v), (b = t);
r = p;
g = v;
b = t;
break;
case 3:
(r = p), (g = q), (b = v);
r = p;
g = q;
b = v;
break;
case 4:
(r = t), (g = p), (b = v);
r = t;
g = p;
b = v;
break;
case 5:
(r = v), (g = p), (b = q);
r = v;
g = p;
b = q;
break;
}
const toHex = (i: number) =>
Expand Down
2 changes: 1 addition & 1 deletion web/src/stores/websocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type EventTypes =

/** @see {isEvent} ts-auto-guard:type-guard */
export type Event = {
Type: EventTypes | string;
Type: EventTypes | string; // eslint-disable-line @typescript-eslint/no-redundant-type-constituents
};

/** @see {isTagEvent} ts-auto-guard:type-guard */
Expand Down

0 comments on commit 4f04498

Please sign in to comment.