From 557d973ba460ccb5b78e39fb0b191420fbbca8b1 Mon Sep 17 00:00:00 2001 From: Cory LaViska Date: Wed, 19 Jan 2022 09:37:07 -0500 Subject: [PATCH] revert rules --- .eslintrc.cjs | 13 +++---------- docs/assets/plugins/metadata/metadata.js | 4 ++-- src/components/animation/animation.ts | 10 +++++----- src/components/avatar/avatar.ts | 3 +-- .../breadcrumb-item/breadcrumb-item.ts | 9 ++++----- src/components/button/button.ts | 5 ++--- src/components/dropdown/dropdown.ts | 13 ++++++------- src/components/icon-button/icon-button.ts | 5 ++--- src/components/icon/icon.ts | 4 ++-- src/components/include/include.ts | 4 ---- src/components/menu/menu.ts | 2 +- src/components/radio/radio.ts | 2 +- src/components/range/range.ts | 2 +- src/components/select/select.ts | 8 ++++---- src/components/split-panel/split-panel.ts | 4 ++-- src/components/tab-group/tab-group.ts | 12 ++++++------ src/components/textarea/textarea.ts | 15 +++++---------- src/components/tooltip/tooltip.ts | 2 +- src/internal/form-control.ts | 18 ++++++------------ src/internal/is-truthy.ts | 4 ---- src/internal/slot.ts | 8 ++------ src/utilities/animation-registry.ts | 4 ++-- src/utilities/base-path.ts | 4 ++-- 23 files changed, 60 insertions(+), 95 deletions(-) delete mode 100644 src/internal/is-truthy.ts diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 5d223a9e..99928f98 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -123,14 +123,7 @@ module.exports = { ], '@typescript-eslint/no-extraneous-class': 'error', '@typescript-eslint/no-parameter-properties': 'error', - '@typescript-eslint/strict-boolean-expressions': [ - 'error', - { - allowString: false, - allowNumber: false, - allowNullableObject: false - } - ] + '@typescript-eslint/strict-boolean-expressions': 'off' } }, { @@ -145,7 +138,7 @@ module.exports = { 'no-template-curly-in-string': 'error', 'array-callback-return': 'error', 'consistent-return': 'error', - curly: 'warn', + curly: 'off', 'default-param-last': 'error', eqeqeq: 'error', 'no-constructor-return': 'error', @@ -154,7 +147,7 @@ module.exports = { 'no-extend-native': 'error', 'no-extra-bind': 'error', 'no-floating-decimal': 'error', - 'no-implicit-coercion': 'error', + 'no-implicit-coercion': 'off', 'no-implicit-globals': 'error', 'no-implied-eval': 'error', 'no-invalid-this': 'error', diff --git a/docs/assets/plugins/metadata/metadata.js b/docs/assets/plugins/metadata/metadata.js index e74812ac..05fc8183 100644 --- a/docs/assets/plugins/metadata/metadata.js +++ b/docs/assets/plugins/metadata/metadata.js @@ -20,7 +20,7 @@ ${props .map(prop => { - const hasAttribute = typeof prop.attribute !== 'undefined'; + const hasAttribute = !!prop.attribute; const isAttributeDifferent = prop.attribute !== prop.name; let attributeInfo = ''; @@ -266,7 +266,7 @@ } function escapeHtml(html) { - if (typeof html === 'undefined') { + if (!html) { return ''; } return html diff --git a/src/components/animation/animation.ts b/src/components/animation/animation.ts index fee72456..cafd31d0 100644 --- a/src/components/animation/animation.ts +++ b/src/components/animation/animation.ts @@ -77,7 +77,7 @@ export default class SlAnimation extends LitElement { } set currentTime(time: number) { - if (typeof this.animation !== 'undefined') { + if (this.animation) { this.animation.currentTime = time; } } @@ -126,7 +126,7 @@ export default class SlAnimation extends LitElement { @watch('play') handlePlayChange() { - if (typeof this.animation !== 'undefined') { + if (this.animation) { if (this.play && !this.hasStarted) { this.hasStarted = true; emit(this, 'sl-start'); @@ -145,7 +145,7 @@ export default class SlAnimation extends LitElement { @watch('playbackRate') handlePlaybackRateChange() { - if (typeof this.animation !== 'undefined') { + if (this.animation) { this.animation.playbackRate = this.playbackRate; } } @@ -162,7 +162,7 @@ export default class SlAnimation extends LitElement { const slot = await this.defaultSlot; const element = slot.assignedElements()[0] as HTMLElement | undefined; - if (typeof element === 'undefined' || typeof keyframes === 'undefined') { + if (!element || !keyframes) { return false; } @@ -192,7 +192,7 @@ export default class SlAnimation extends LitElement { } destroyAnimation() { - if (typeof this.animation !== 'undefined') { + if (this.animation) { this.animation.cancel(); this.animation.removeEventListener('cancel', this.handleAnimationCancel); this.animation.removeEventListener('finish', this.handleAnimationFinish); diff --git a/src/components/avatar/avatar.ts b/src/components/avatar/avatar.ts index eb5a0d25..ff969e84 100644 --- a/src/components/avatar/avatar.ts +++ b/src/components/avatar/avatar.ts @@ -3,7 +3,6 @@ import { customElement, property, state } from 'lit/decorators.js'; import { classMap } from 'lit/directives/class-map.js'; import styles from './avatar.styles'; import '~/components/icon/icon'; -import { isTruthy } from '~/internal/is-truthy'; /** * @since 2.0 @@ -51,7 +50,7 @@ export default class SlAvatar extends LitElement { role="img" aria-label=${this.label} > - ${isTruthy(this.initials) + ${this.initials ? html`
${this.initials}
` : html`