Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | 4x 2x 4x 2x 3x 2x 2x 2x 4x 2x 4x 2x 2x 2x 2x 2x 2x 4x 4x 4x 4x 4x 4x 4x 7x 4x 4x 4x 4x 4x 4x 4x | <template>
<WidgetPanel :title="$t('telemetryLintUsage.title')" :meta="$t('telemetryLintUsage.meta')">
<p class="border-b border-default px-4 py-2 text-xs text-muted">
{{ $t("telemetryLintUsage.scope") }}
</p>
<div data-scroll-x class="overflow-x-auto">
<table class="data-table">
<thead>
<tr>
<th>{{ $t("telemetryLintUsage.columns.rule") }}</th>
<th
v-for="project in table.projects"
:key="project"
class="hidden w-32 min-w-32 text-center whitespace-nowrap md:table-cell"
>
{{ project }}
</th>
<th class="numeric">{{ $t("telemetryLintUsage.columns.total") }}</th>
<th class="numeric whitespace-nowrap">
{{ $t("telemetryLintUsage.columns.fixed") }}
</th>
<th class="numeric whitespace-nowrap">
{{ $t("telemetryLintUsage.columns.disabled") }}
</th>
</tr>
</thead>
<tbody>
<tr v-for="row in rows" :key="row.rule">
<td class="font-mono text-xs whitespace-nowrap">{{ row.rule }}</td>
<td
v-for="cell in row.cells"
:key="cell.project"
class="hidden w-32 min-w-32 p-0.5 md:table-cell"
>
<div
class="flex h-8 items-center justify-center rounded-xs text-xs tabular-nums"
:style="cell.style"
>
{{ cell.count }}
</div>
</td>
<td class="numeric font-semibold">{{ row.hits }}</td>
<td class="numeric text-xs text-muted">{{ row.fixed }}</td>
<td class="numeric text-xs" :class="row.fought && 'tone-bad font-semibold'">
{{ row.disabled }}
</td>
</tr>
</tbody>
</table>
</div>
<div class="flex flex-col gap-2 border-t border-default px-4 py-3">
<div class="flex flex-wrap items-baseline justify-between gap-2">
<h2 class="text-sm font-semibold">
{{
$t("telemetryLintUsage.neverFired", {
quiet: quiet.length,
enabled: enabledCount,
})
}}
</h2>
<UButton
v-if="quiet.length > 0"
variant="link"
size="xs"
:label="
showQuiet ? $t('telemetryLintUsage.hide') : $t('telemetryLintUsage.show')
"
@click="showQuiet = !showQuiet"
/>
</div>
<p class="text-xs text-muted">{{ $t("telemetryLintUsage.quiet", { watching }) }}</p>
<p v-if="showQuiet" class="font-mono text-xs/relaxed text-muted">
{{ quietList }}
</p>
</div>
</WidgetPanel>
</template>
<script setup lang="ts">
import { FOUGHT_DISABLES, neverFired } from "#layers/telemetry/shared/lintUsage.ts";
import { lintTable } from "#layers/telemetry/shared/usageView.ts";
import type { LintUsage } from "#layers/snapshot/shared/types/LintUsage.ts";
interface Props {
lint: LintUsage;
}
const props = defineProps<Props>();
const { t } = useI18n();
const showQuiet = ref(false);
const table = computed(() => lintTable(props.lint));
const quiet = computed(() => neverFired(props.lint));
const quietList = computed(() => quiet.value.join(" ยท "));
const enabledCount = computed(
() => Object.values(props.lint.rules).filter((r) => r.enabled).length,
);
const rows = computed(() => {
const busiest = Math.max(1, ...table.value.rows.flatMap((row) => row.projects));
return table.value.rows.map((row) => ({
rule: row.rule,
hits: row.hits || "โ",
fixed: row.hits ? `${percentOf(row.fixable, row.hits)}%` : "โ",
disabled: row.disabled || "โ",
fought: row.disabled >= FOUGHT_DISABLES,
cells: table.value.projects.map((project, index) => {
const count = row.projects[index] ?? 0;
return {
project,
count: count || "",
style: { background: heatColor("--usage-hits", count, busiest) },
};
}),
}));
});
const watching = computed(() =>
props.lint.since
? t("telemetryLintUsage.since", { since: props.lint.since })
: t("telemetryLintUsage.nothingYet"),
);
</script>
|