Skip to content

Commit

Permalink
Fix eslint #3
Browse files Browse the repository at this point in the history
  • Loading branch information
rzats committed Oct 22, 2024
1 parent 78761f5 commit 0953338
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 6 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ module.exports = {
rules: {
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-unnecessary-type-assertion': 'off', // generate as a bunch of false positives
'@typescript-eslint/no-base-to-string': 'off', // false positives in deriveLinkDefaults
},
},
],
Expand Down
15 changes: 13 additions & 2 deletions src/components/tree/TreeInnerNode.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import DataSet from '../../data/DataSet';
import type { DataGroup } from '../../data/DataSet';
import type { IChart } from '../store';
import type { IChart } from '../../store';
import { expandedDataGroups } from '../../store';
import TreeLeafNode from './TreeLeafNode.svelte';
import Fa from 'svelte-fa';
Expand All @@ -21,7 +21,18 @@
</script>

<div class="tv_node">
<span on:click={toggleExpanded}>
<span
on:click={toggleExpanded}
role="button"
tabindex="0"
on:keydown={(e) => {
if (e.key !== 'Enter' && e.key !== ' ') return;
e.preventDefault();
if (e.target != null) {
e.target.click();
}
}}
>
<Fa icon={expanded ? faChevronDown : faChevronRight} style="width: 0.9em; margin-right: 0.5em" />
<span>
{node.title}
Expand Down
9 changes: 9 additions & 0 deletions src/components/tree/TreeLeafNode.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@
class="tv_node"
class:selected
on:click={toggleSelected}
role="button"
tabindex="0"
on:keydown={(e) => {
if (e.key !== 'Enter' && e.key !== ' ') return;
e.preventDefault();
if (e.target != null) {
e.target.click();
}
}}
title="click to toggle the visibility of this dataset"
uk-tooltip="pos: right"
>
Expand Down
5 changes: 4 additions & 1 deletion src/data/DataSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ export default class DataSet {
export class DataGroup {
public parent?: DataGroup;

constructor(public readonly title: string, public readonly datasets: (DataSet | DataGroup)[]) {}
constructor(
public readonly title: string,
public readonly datasets: (DataSet | DataGroup)[],
) {}

flat(arr: DataSet[]): void {
for (const child of this.datasets) {
Expand Down
6 changes: 5 additions & 1 deletion src/data/EpiDate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ export default class EpiDate {
private static CUMULATIVE_DAYS_PER_MONTH = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];
private static DAY_OF_WEEK_TABLE = [0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4];

constructor(private readonly year: number, private readonly month: number, private readonly day: number) {
constructor(
private readonly year: number,
private readonly month: number,
private readonly day: number,
) {
// constructor logic
if (
year < 1 ||
Expand Down
5 changes: 4 additions & 1 deletion src/data/EpiPoint.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import type EpiDate from './EpiDate';

export default class EpiPoint {
constructor(private readonly date: EpiDate, private readonly value: number) {}
constructor(
private readonly date: EpiDate,
private readonly value: number,
) {}
getDate(): EpiDate {
return this.date;
}
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"strictNullChecks": true,
"strictPropertyInitialization": true,
"resolveJsonModule": true,
"verbatimModuleSyntax": true,
"verbatimModuleSyntax": true
},
"include": ["src/**/*", "types.d.ts"],
"exclude": ["node_modules/*", "__sapper__/*", "public/*"]
Expand Down

0 comments on commit 0953338

Please sign in to comment.