Skip to content

Commit

Permalink
Handle Svelte Compiler Warnings (#3607)
Browse files Browse the repository at this point in the history
* Fix SCSS preprocessor in Svelte config

* Adapt SCSS config

* Ignore Svelte key event warnings

* Remove unused component props

* Ignore Svelte tabindex warnings

* Ignore Svelte href warnings

* Fix unused CSS selectors

* Ignore Svelte autofocus warnings

* Fix Svelte warnings about redundant aria roles

* Fix warning about missing aria role

* Ignore warnings about href values

* Fix warnings about non-root "$:"

* Fix deprecation warnings about using "type"

---------

Co-authored-by: Ndricim <[email protected]>
Co-authored-by: Johannes Doberer <[email protected]>
  • Loading branch information
3 people authored Jan 26, 2024
1 parent 44f3578 commit ef4d941
Show file tree
Hide file tree
Showing 26 changed files with 116 additions and 107 deletions.
2 changes: 1 addition & 1 deletion core/src/Alerts.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
{/each}
</div>

<style type="text/scss">
<style lang="scss">
.luigi-alert--overlay {
position: absolute;
z-index: 1100;
Expand Down
31 changes: 13 additions & 18 deletions core/src/App.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script type="text/javascript">
<script>
import Alerts from './Alerts.svelte';
import ConfirmationModal from './ConfirmationModal.svelte';
import Modal from './Modal.svelte';
Expand Down Expand Up @@ -109,7 +109,6 @@
export let inputElem;
export let luigiCustomSearchRenderer__slot;
export let displaySearchResult;
export let displayCustomSearchResult = true;
export let searchResult;
export let storedUserSettings;
Expand Down Expand Up @@ -190,7 +189,7 @@
const nextPath = buildPath(data.params);
const nodePath = Routing.getNodePath(currentNode, urlParamsRaw);
$: preservedViews.push({
preservedViews.push({
path:
config.iframe.luigi && config.iframe.luigi.pathParams
? GenericHelpers.replaceVars(
Expand Down Expand Up @@ -627,7 +626,6 @@
if (
GenericHelpers.isFunction(searchProvider.customSearchResultRenderer)
) {
displayCustomSearchResult = true;
let searchApiObj = {
fireItemSelected: (item) => {
searchProvider.onSearchResultItemSelected(item);
Expand Down Expand Up @@ -717,22 +715,22 @@
const splitViewIframeCreated = (event) => {
splitViewIframe = event.detail.splitViewIframe;
splitViewIframeData = event.detail.splitViewIframeData;
$: mfSplitView.collapsed = event.detail.collapsed;
mfSplitView.collapsed = event.detail.collapsed;
};
const splitViewStatusChanged = (event) => {
$: if (event.detail.displayed !== undefined) {
if (event.detail.displayed !== undefined) {
mfSplitView.displayed = event.detail.displayed;
}
$: if (event.detail.collapsed !== undefined) {
if (event.detail.collapsed !== undefined) {
mfSplitView.collapsed = event.detail.collapsed;
}
};
const splitViewWCCreated = (event) => {
splitViewWC = event.detail.splitViewWC;
splitViewWCData = event.detail.splitViewWCData;
$: mfSplitView.collapsed = event.detail.collapsed;
mfSplitView.collapsed = event.detail.collapsed;
};
/// RESIZING
Expand Down Expand Up @@ -2075,6 +2073,7 @@
/>
{/if}
<Backdrop disable={disableBackdrop}>
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
<div
class="fd-page iframeContainer"
class:lui-split-view={mfSplitView.displayed}
Expand Down Expand Up @@ -2126,7 +2125,6 @@
on:handleSearchNavigation={handleSearchNavigation}
bind:isSearchFieldVisible
bind:displaySearchResult
bind:displayCustomSearchResult
bind:searchResult
bind:inputElem
bind:luigiCustomSearchRenderer__slot
Expand Down Expand Up @@ -2166,10 +2164,7 @@
{/if}
</div>
<style type="text/scss">
@import 'src/styles/_mixins.scss';
@import 'src/styles/_variables.scss';
<style lang="scss">
/* custom width of left side nav, single App title width or Multiple-App dropdown width*/
:root {
--luigi__left-sidenav--width: 15rem;
Expand Down Expand Up @@ -2306,14 +2301,14 @@
overflow: hidden;
margin-bottom: -5px;
}
.iframeContainerNoNav {
:global(.iframeContainerNoNav) {
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
}
.iframeContainerNoNav :global(iframe) {
:global(.iframeContainerNoNav iframe) {
border: none;
width: 100%;
height: 100%;
Expand Down Expand Up @@ -2633,7 +2628,7 @@
:global(html.luigi-app-in-custom-container) {
position: relative;
[luigi-app-root] {
:global([luigi-app-root]) {
position: relative;
overflow: hidden;
}
Expand All @@ -2656,7 +2651,7 @@
:global(.fd-side-nav--condensed) {
:global(.fd-nested-list__link) {
font-size: 10px;
&.has-child:after {
&:global(.has-child:after) {
height: 0;
}
}
Expand Down Expand Up @@ -2747,7 +2742,7 @@
display: block;
}
iframe {
:global(iframe) {
display: none;
}
}
Expand Down
8 changes: 4 additions & 4 deletions core/src/Authorization.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,11 @@

<ul
class="fd-list fd-list--compact fd-list--navigation fd-list--navigation-indication fd-list--no-border"
role="list"
>
{#each profileNav.items as profileItem}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<li
tabindex="-1"
role="listitem"
class="fd-list__item fd-list__item--link"
on:click={() => onActionClick(profileItem)}
data-testid={getTestId(profileItem)}
Expand Down Expand Up @@ -274,11 +273,12 @@
{#if hasUserSettings}
<li
tabindex="-1"
role="listitem"
class="fd-list__item fd-list__item--link lui-anchor-node"
on:click|preventDefault={onUserSettingsClick}
on:keyup={event => handleKeyUp(event)}
>
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
<!-- svelte-ignore a11y-missing-attribute -->
<a
tabindex="0"
class="fd-list__link"
Expand Down Expand Up @@ -355,7 +355,7 @@
</div>
{/if}

<style type="text/scss">
<style lang="scss">
.fd-top-nav__icon {
display: inline-block;
vertical-align: middle;
Expand Down
8 changes: 7 additions & 1 deletion core/src/AuthorizationSimpleProfileMenu.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@
</li>
{/if}
{#each profileNav.items as profileItem}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<li
class="fd-menu__item"
on:click={() => onActionClick(profileItem)}
Expand Down Expand Up @@ -245,6 +246,8 @@
on:keyup={event => handleKeyUp(event)}
data-testid={getTestId(profileNav.settings)}
>
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
<!-- svelte-ignore a11y-missing-attribute -->
<a
tabindex="0"
title="User Settings"
Expand Down Expand Up @@ -276,6 +279,7 @@
{/if}
{#if isAuthorizationEnabled || isProfileLogoutItem}
{#if isLoggedIn || (!isAuthorizationEnabled && isProfileLogoutItem)}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<li
class="fd-menu__item"
on:click={onLogoutClick}
Expand Down Expand Up @@ -310,7 +314,9 @@
</li>
{/if}
{#if isAuthorizationEnabled && !isLoggedIn}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<li class="fd-menu__item" on:click={startAuthorization}>
<!-- svelte-ignore a11y-missing-attribute -->
<a aria-label="Login" class="fd-menu__link" data-testid="login-btn">
<span class="fd-menu__title">Login</span>
</a>
Expand All @@ -321,7 +327,7 @@
</nav>
{/if}

<style type="text/scss">
<style lang="scss">
.fd-top-nav__icon {
display: inline-block;
vertical-align: middle;
Expand Down
2 changes: 1 addition & 1 deletion core/src/Backdrop.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
<slot />
</div>

<style type="text/scss">
<style lang="scss">
.lui-backdrop {
background-color: rgba(0, 0, 0, 0.6);
position: absolute;
Expand Down
4 changes: 1 addition & 3 deletions core/src/ConfirmationModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,7 @@
</section>
</div>

<style type="text/scss">
@import 'src/styles/_variables.scss';
<style lang="scss">
.fd-message-box {
z-index: 1001;
&__body {
Expand Down
3 changes: 1 addition & 2 deletions core/src/Modal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,7 @@
</div>
</div>
<style type="text/scss">
@import 'src/styles/_variables.scss';
<style lang="scss">
:global(.lui-breadcrumb) .drawer-dialog {
top: calc(#{$topNavHeight} + var(--luigi__breadcrumb--height));
}
Expand Down
8 changes: 5 additions & 3 deletions core/src/SplitView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,8 @@
id="splitViewDraggerCollapsed"
class="splitViewSeparator isCollapsed"
>
<!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-missing-attribute -->
<a
class="lui-collapse-btn"
on:click|stopPropagation|preventDefault={expand}
Expand All @@ -317,6 +319,8 @@
<div id="splitViewDraggerBackdrop" />
<div id="splitViewDragger" on:mousedown|stopPropagation={onDragStart}>
<div class="splitViewSeparator" />
<!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-missing-attribute -->
<a
class="lui-collapse-btn"
on:click|stopPropagation|preventDefault={collapse}
Expand All @@ -326,9 +330,7 @@
</div>
{/if}

<style type="text/scss">
@import 'src/styles/_variables.scss';
<style lang="scss">
$collapsedSplitviewHeight: 38px;
$colorNeutral4: #89919a;
Expand Down
3 changes: 2 additions & 1 deletion core/src/TopNavDropDown.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
{#if children}
{#each children as node}
{#if node.label}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<li
class="fd-menu__item"
on:click={() => onActionClick(node)}
Expand Down Expand Up @@ -162,7 +163,7 @@
/>
{/if}

<style type="text/scss">
<style lang="scss">
.fd-top-nav__icon {
img {
max-width: 16px;
Expand Down
5 changes: 2 additions & 3 deletions core/src/UserSettingsDialog.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import { LuigiConfig } from './core-api';
import { TOP_NAV_DEFAULTS } from './utilities/luigi-config-defaults';
import { KEYCODE_ESC, KEYCODE_ENTER, KEYCODE_SPACE, KEYCODE_HOME, KEYCODE_END } from './utilities/keycode.js';
export let schemaObj;
export let userSettingGroups;
Expand Down Expand Up @@ -333,6 +332,7 @@
</script>

<svelte:window on:resize={onResize} on:keydown={handleKeyDown} />
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
<div class="fd-dialog fd-dialog--active lui-usersettings-dialog" tabindex="0">
<div
class="fd-dialog__content lui-usersettings-dialog-size"
Expand All @@ -353,19 +353,18 @@
>
<ul
class="fd-list fd-list--byline fd-list--navigation lui-us-list"
role="list"
>
{#each Object.entries(userSettingGroups) as [key, userSettingGroup], index}
{#each Object.entries(userSettingGroup) as userSettingsGroupProperty}
<li
role="listitem"
class="fd-list__item fd-list__item--link lui-us-navlist__item"
data-testid="us-navigation-item"
on:click|preventDefault={() =>
openEditor(userSettingsGroupProperty, event)}
on:keydown={event => handleKeyUp(event, [index])}
tabindex="0"
>
<!-- svelte-ignore a11y-invalid-attribute -->
<a tabindex="-1" class="fd-list__link" href="#">
{#if userSettingsGroupProperty[1].icon}
{#if hasOpenUIicon(userSettingsGroupProperty[1])}
Expand Down
6 changes: 4 additions & 2 deletions core/src/UserSettingsEditor.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
KEYCODE_ARROW_DOWN,
} from './utilities/keycode.js';
export let userSettingGroup;
export let userSettingsGroupKey;
export let storedUserSettingData;
const dispatch = createEventDispatcher();
let getTranslation = getContext('getTranslation');
Expand Down Expand Up @@ -260,6 +259,7 @@
{#if schemaItem.type === 'enum' && (schemaItem.style === undefined || schemaItem.style === 'list')}
<div class="fd-form-item">
<div class="fd-popover">
<!-- svelte-ignore a11y-click-events-have-key-events -->
<div
class="fd-popover__control"
aria-expanded="false"
Expand Down Expand Up @@ -323,6 +323,8 @@
class:is-focus={selectedLanguageLabel ===
optionIndex}
data-testid="lui-us-option{index}_{optionIndex}"
aria-selected={selectedLanguageLabel ===
optionIndex}
on:click={() =>
updateComboBox(key, option, optionIndex)}
on:keydown={event =>
Expand Down Expand Up @@ -454,7 +456,7 @@
.fd-row .fd-col .fd-select__control.lui-anchor-node {
margin: 0;
}
.fd-select__control.lui-anchor-node[aria-expanded='true']:focus {
.fd-select__control:global(.lui-anchor-node[aria-expanded='true']:focus) {
outline: none;
}
Expand Down
8 changes: 4 additions & 4 deletions core/src/navigation/BadgeCounter.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
{/await}
{/if}

<style type="text/scss">
<style lang="scss">
:global(.fd-shellbar__action) {
.fd-shellbar__counter--notification {
top: 0;
color: var(--sapContent_BadgeTextColor, #fff);
}
.fd-menu .fd-top-nav__icon {
:global(.fd-menu .fd-top-nav__icon) {
position: relative;
margin-right: 8px;
min-width: 16px;
Expand All @@ -33,8 +33,8 @@
}
}
.fd-product-switch__body--mobile {
.lui-product-switch__icon {
:global(.fd-product-switch__body--mobile) {
:global(.lui-product-switch__icon) {
position: relative;
.fd-shellbar__counter--notification {
Expand Down
Loading

0 comments on commit ef4d941

Please sign in to comment.