Skip to content

Commit 0291215

Browse files
committed
chore: eslint
1 parent 37df149 commit 0291215

File tree

7 files changed

+43
-19
lines changed

7 files changed

+43
-19
lines changed

eslint.config.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export default [
3131
'vite.config.ts',
3232
'stories/',
3333
'**/.storybook/**',
34+
'**/*.test.ts',
3435
],
3536
},
3637

@@ -50,10 +51,12 @@ export default [
5051
semi: ['warn', 'always'],
5152
'no-unused-vars': 'off', //Let '@typescript-eslint/no-unused-vars' catch the errors to allow unused function parameters (ex: in interfaces)
5253
'no-var': 'error',
54+
'@typescript-eslint/no-unsafe-function-type': 'warn',
5355
'@typescript-eslint/explicit-module-boundary-types': 'off',
5456
'@typescript-eslint/no-non-null-assertion': 'off',
5557
'@typescript-eslint/no-explicit-any': 'off',
5658
'@typescript-eslint/no-inferrable-types': 'off',
59+
'@typescript-eslint/no-empty-object-type': 'off',
5760
'@typescript-eslint/ban-ts-comment': 'off', //TODO: Remove (maybe)
5861
'@typescript-eslint/ban-types': 'off', //TODO: Remove (maybe)
5962
'lit/no-useless-template-literals': 'error',

packages/uui-base/lib/mixins/PopoverTargetMixin.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,13 @@ export const PopoverTargetMixin = <T extends Constructor<LitElement>>(
5858
);
5959
if (!popoverContainerElement) return;
6060

61-
this.#popoverIsOpen
62-
? // @ts-ignore - This is part of the new popover API, but typescript doesn't recognize it yet.
63-
popoverContainerElement.hidePopover()
64-
: // @ts-ignore - This is part of the new popover API, but typescript doesn't recognize it yet.
65-
popoverContainerElement.showPopover();
61+
if (this.#popoverIsOpen) {
62+
// @ts-ignore - This is part of the new popover API, but typescript doesn't recognize it yet.
63+
popoverContainerElement.hidePopover();
64+
} else {
65+
// @ts-ignore - This is part of the new popover API, but typescript doesn't recognize it yet.
66+
popoverContainerElement.showPopover();
67+
}
6668
};
6769

6870
#popoverListener = (event: any) => {

packages/uui-base/lib/mixins/SelectableMixin.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,10 @@ export const SelectableMixin = <T extends Constructor<LitElement>>(
153153
if (!this.selectable) return;
154154
if (this.deselectable === false) {
155155
this.#select();
156+
} else if (this.selected) {
157+
this.#deselect();
156158
} else {
157-
this.selected ? this.#deselect() : this.#select();
159+
this.#select();
158160
}
159161
}
160162

packages/uui-combobox-list/lib/uui-combobox-list.element.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,20 @@ export class UUIComboboxListElement extends LitElement {
210210
switch (e.key) {
211211
case 'ArrowUp':
212212
e.preventDefault();
213-
e.ctrlKey ? this._moveIndex(-10) : this._moveIndex(-1);
213+
if (e.ctrlKey) {
214+
this._moveIndex(-10);
215+
} else {
216+
this._moveIndex(-1);
217+
}
214218
break;
215219

216220
case 'ArrowDown':
217221
e.preventDefault();
218-
e.ctrlKey ? this._moveIndex(10) : this._moveIndex(1);
222+
if (e.ctrlKey) {
223+
this._moveIndex(10);
224+
} else {
225+
this._moveIndex(1);
226+
}
219227

220228
break;
221229

packages/uui-popover/lib/uui-popover.element.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,11 @@ export class UUIPopoverElement extends LitElement {
9494
set open(newValue) {
9595
const oldValue = this._open;
9696
this._open = newValue;
97-
newValue ? this._openPopover() : this._closePopover();
97+
if (newValue) {
98+
this._openPopover();
99+
} else {
100+
this._closePopover();
101+
}
98102
this.requestUpdate('open', oldValue);
99103
}
100104

packages/uui-table/lib/uui-table-advanced-example.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import '@umbraco-ui/uui-checkbox/lib';
66
import '@umbraco-ui/uui-icon/lib';
77
import '@umbraco-ui/uui-progress-bar/lib';
88
import '@umbraco-ui/uui-tag/lib';
9+
import '@umbraco-ui/uui-symbol-sort/lib';
910

1011
import { UUITextStyles } from '@umbraco-ui/uui-css/lib';
1112
import { css, html, LitElement } from 'lit';
@@ -15,7 +16,7 @@ import { defineElement } from '@umbraco-ui/uui-base/lib/registration';
1516

1617
interface TableColumn {
1718
name: string;
18-
sort: Function;
19+
sort: (items: Array<TableItem>, desc: boolean) => Array<TableItem>;
1920
}
2021

2122
interface TableItem {
@@ -224,9 +225,9 @@ export class UUITableWithSelectionExampleElement extends LitElement {
224225
<uui-table-cell>${item.signUpDate}</uui-table-cell>
225226
<uui-table-cell>${item.email}</uui-table-cell>
226227
<uui-table-cell>
227-
<uui-tag color="${item.newsletter ? 'positive' : 'secondary'}" size="s"
228-
>${item.newsletter ? 'Yes' : 'No'}</uui-tag
229-
>
228+
<uui-tag color="${item.newsletter ? 'positive' : 'danger'}">
229+
${item.newsletter ? 'Yes' : 'No'}
230+
</uui-tag>
230231
</uui-table-cell>
231232
</uui-table-row>`;
232233
};

packages/uui-tabs/lib/uui-tab-group.element.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,11 @@ export class UUITabGroupElement extends LitElement {
145145
el => el.active && el !== linkedElement,
146146
);
147147

148-
hasActiveHidden
149-
? this._moreButtonElement.classList.add('active-inside')
150-
: this._moreButtonElement.classList.remove('active-inside');
148+
if (hasActiveHidden) {
149+
this._moreButtonElement.classList.add('active-inside');
150+
} else {
151+
this._moreButtonElement.classList.remove('active-inside');
152+
}
151153
}
152154
};
153155

@@ -250,9 +252,11 @@ export class UUITabGroupElement extends LitElement {
250252
this._moreButtonElement.style.display = '';
251253
}
252254

253-
hasActiveTabInDropdown
254-
? this._moreButtonElement.classList.add('active-inside')
255-
: this._moreButtonElement.classList.remove('active-inside');
255+
if (hasActiveTabInDropdown) {
256+
this._moreButtonElement.classList.add('active-inside');
257+
} else {
258+
this._moreButtonElement.classList.remove('active-inside');
259+
}
256260

257261
this.requestUpdate();
258262
}

0 commit comments

Comments
 (0)