Skip to content

Commit 942f4a9

Browse files
chore: use type-safe PropertyValues and use linting suggestion
1 parent c50c570 commit 942f4a9

File tree

10 files changed

+22
-21
lines changed

10 files changed

+22
-21
lines changed

packages/elements/src/components/app/app.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export class MutationTestReportAppComponent extends RealTimeElement {
124124
}
125125
}
126126

127-
public willUpdate(changedProperties: PropertyValues) {
127+
public willUpdate(changedProperties: PropertyValues<this>) {
128128
if (this.report) {
129129
// Set the theme when no theme is selected (light vs dark)
130130
if (!this.theme) {
@@ -146,7 +146,7 @@ export class MutationTestReportAppComponent extends RealTimeElement {
146146
private mutants = new Map<string, MutantModel>();
147147
private tests = new Map<string, TestModel>();
148148

149-
public updated(changedProperties: PropertyValues) {
149+
public updated(changedProperties: PropertyValues<this>) {
150150
if (changedProperties.has('theme') && this.theme) {
151151
this.dispatchEvent(
152152
createCustomEvent('theme-changed', {

packages/elements/src/components/breadcrumb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { tailwind } from '../style/index.js';
77

88
@customElement('mte-breadcrumb')
99
export class MutationTestReportBreadcrumbComponent extends LitElement {
10-
@property()
10+
@property({ attribute: false })
1111
public declare path: string[] | undefined;
1212

1313
@property()

packages/elements/src/components/drawer-test/drawer-test.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const describeMutant = (mutant: MutantModel) => html`<code>${mutant.getMutatedLi
1414

1515
@customElement('mte-drawer-test')
1616
export class MutationTestReportDrawerTestComponent extends RealTimeElement {
17-
@property()
17+
@property({ attribute: false })
1818
public declare test?: TestModel;
1919

2020
@property({ reflect: true })

packages/elements/src/components/drawer/drawer.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class MutationTestReportDrawer extends LitElement {
2222
@property({ reflect: true, type: Boolean })
2323
public declare hasDetail;
2424

25-
@property()
25+
@property({ attribute: false })
2626
public get toggleMoreLabel() {
2727
switch (this.mode) {
2828
case 'half':

packages/elements/src/components/file/file.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class FileComponent extends RealTimeElement {
2424
@state()
2525
public declare filters: StateFilter<MutantStatus>[];
2626

27-
@property()
27+
@property({ attribute: false })
2828
public declare model: FileUnderTestModel;
2929

3030
@state()
@@ -203,7 +203,7 @@ export class FileComponent extends RealTimeElement {
203203
this.updateFileRepresentation();
204204
}
205205

206-
public update(changes: PropertyValues<FileComponent>) {
206+
public update(changes: PropertyValues<this>) {
207207
if (changes.has('model') && this.model) {
208208
this.updateFileRepresentation();
209209
}

packages/elements/src/components/metrics-table/metrics-table.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@ export interface Column<TMetric> {
2929

3030
@customElement('mte-metrics-table')
3131
export class MutationTestReportTestMetricsTable<TFile, TMetric> extends RealTimeElement {
32-
@property()
32+
@property({ attribute: false })
3333
public declare model?: MetricsResult<TFile, TMetric>;
3434

35-
@property()
35+
@property({ type: Array })
3636
public declare currentPath: string[];
3737

3838
@property({ type: Array })
3939
public declare columns: Column<TMetric>[];
4040

41-
@property()
41+
@property({ attribute: false })
4242
public declare thresholds: Thresholds;
4343

4444
public static styles = [tailwind];
@@ -54,7 +54,7 @@ export class MutationTestReportTestMetricsTable<TFile, TMetric> extends RealTime
5454

5555
private hasMultipleColspan = false;
5656

57-
public override willUpdate(changedProperties: PropertyValues) {
57+
public override willUpdate(changedProperties: PropertyValues<this>) {
5858
if (changedProperties.has('columns')) {
5959
this.hasMultipleColspan = this.columns.some((column) => column.category === 'percentage');
6060
}

packages/elements/src/components/mutant-view/mutant-view.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ export class MutationTestReportMutantViewComponent extends RealTimeElement {
1515
@property()
1616
public declare drawerMode: DrawerMode;
1717

18-
@property()
18+
@property({ attribute: false })
1919
private declare selectedMutant?: MutantModel;
2020

2121
public static styles = [unsafeCSS(style), tailwind];
2222

23-
@property()
23+
@property({ attribute: false })
2424
public declare result: MetricsResult<FileUnderTestModel, Metrics>;
2525

2626
@property({ attribute: false, reflect: false })
@@ -44,7 +44,7 @@ export class MutationTestReportMutantViewComponent extends RealTimeElement {
4444
this.drawerMode = event.detail.selected ? 'half' : 'closed';
4545
};
4646

47-
updated(changes: PropertyValues) {
47+
updated(changes: PropertyValues<this>) {
4848
if (changes.has('result') && !this.result.file) {
4949
this.drawerMode = 'closed';
5050
}

packages/elements/src/components/state-filter/state-filter.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class FileStateFilterComponent<TStatus extends string> extends RealTimeEl
2323
@property({ type: Array })
2424
public declare filters?: StateFilter<TStatus>[];
2525

26-
public updated(changedProperties: PropertyValues) {
26+
public updated(changedProperties: PropertyValues<this>) {
2727
if (changedProperties.has('filters')) {
2828
this.dispatchFiltersChangedEvent();
2929
}

packages/elements/src/components/test-file/test-file.component.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import type { StateFilter } from '../state-filter/state-filter.component.js';
2222
export class TestFileComponent extends RealTimeElement {
2323
public static styles = [prismjs, tailwind, unsafeCSS(style)];
2424

25-
@property()
25+
@property({ attribute: false })
2626
public declare model: TestFileModel | undefined;
2727

2828
@state()
@@ -212,7 +212,7 @@ export class TestFileComponent extends RealTimeElement {
212212
this.updateFileRepresentation();
213213
}
214214

215-
override willUpdate(changes: PropertyValues<TestFileComponent>) {
215+
override willUpdate(changes: PropertyValues<this>) {
216216
if (changes.has('model')) {
217217
this.updateFileRepresentation();
218218
}
@@ -229,7 +229,8 @@ export class TestFileComponent extends RealTimeElement {
229229
}
230230
});
231231
}
232-
super.update(changes);
232+
233+
super.willUpdate(changes);
233234
}
234235

235236
private updateFileRepresentation() {

packages/elements/src/components/test-view/test-view.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ export class MutationTestReportTestViewComponent extends RealTimeElement {
1414
@property()
1515
public declare drawerMode: DrawerMode;
1616

17-
@property()
17+
@property({ attribute: false })
1818
public declare result: MetricsResult<TestFileModel, TestMetrics>;
1919

2020
@property({ attribute: false, reflect: false })
2121
public declare path: string[];
2222

23-
@property()
23+
@property({ attribute: false })
2424
private declare selectedTest?: TestModel;
2525

2626
public static styles = [unsafeCSS(style), tailwind];
@@ -40,7 +40,7 @@ export class MutationTestReportTestViewComponent extends RealTimeElement {
4040
this.drawerMode = event.detail.selected ? 'half' : 'closed';
4141
};
4242

43-
public updated(changes: PropertyValues) {
43+
public updated(changes: PropertyValues<this>) {
4444
if (changes.has('result') && !this.result.file) {
4545
this.drawerMode = 'closed';
4646
}

0 commit comments

Comments
 (0)