Skip to content

Commit

Permalink
Changed eslint configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
pablo.garcia.almis committed Apr 13, 2024
1 parent a2c6005 commit cb5a628
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 94 deletions.
77 changes: 0 additions & 77 deletions .eslintrc.js

This file was deleted.

13 changes: 8 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@
"homepage": "https://github.com/gallery-card/gallery-card#readme",
"devDependencies": {
"@babel/core": "^7.12.3",
"@babel/eslint-parser": "^7.24.1",
"@babel/plugin-proposal-class-properties": "^7.12.1",
"@babel/plugin-proposal-decorators": "^7.12.1",
"@babel/eslint-parser": "^7.24.1",
"@eslint-recommended/eslint-config": "24.0.0",
"@eslint/js": "^9.0.0",
"@rollup/plugin-babel": "^5.2.1",
"@rollup/plugin-commonjs": "^16.0.0",
"@rollup/plugin-json": "^4.0.2",
Expand All @@ -45,16 +47,17 @@
"eslint-config-prettier": "^8.10.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "^5.1.3",
"@eslint-recommended/eslint-config": "24.0.0",
"npm": "^9.9.3",
"eslint-plugin-react": "^7.34.1",
"globals": "^15.0.0",
"npm": "^10.5.2",
"prettier": "^3.2.5",
"prettier-eslint": "^16.3.0",
"rollup": "^2.33.1",
"rollup-plugin-cleanup": "^3.2.1",
"rollup-plugin-serve": "^1.1.0",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.29.0",
"semantic-release": "^17.3.8",
"semantic-release": "^23.0.8",
"yarn-audit-fix": "^9.3.10"
},
"dependencies": {
Expand All @@ -63,4 +66,4 @@
"lit-element": "^3.3.2",
"lit-html": "^2.7.5"
}
}
}
24 changes: 12 additions & 12 deletions src/gallery-card-2024.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class GalleryCard2024 extends LitElement {
${this.currentResourceIndex === undefined || !(this.config.enable_date_search ?? false) ?
html`` : html`<input type="date" class="date-picker" @change="${this._handleDateChange}" value="${this._formatDateForInput(this.selectedDate)}">` }
${this.currentResourceIndex === undefined || !(this.config.show_reload ?? false) ?
html`` : html`<ha-progress-button class="btn-reload" @click="${event => this._loadResources(this._hass)}">Reload</ha-progress-button>` }
html`` : html`<ha-progress-button class="btn-reload" @click="${() => this._loadResources(this._hass)}">Reload</ha-progress-button>` }
<div class="resource-viewer" @touchstart="${event => this._handleTouchStart(event)}" @touchmove="${event => this._handleTouchMove(event)}">
<figure style="margin:5px;">
${
Expand All @@ -50,13 +50,13 @@ class GalleryCard2024 extends LitElement {
${this.config.show_zoom ? html`<a href= "${this._currentResource().url}" target="_blank">Zoom</a>` : html`` }
</figcaption>
</figure>
<button class="btn btn-left" @click="${event => this._selectResource(this.currentResourceIndex-1)}">&lt;</button>
<button class="btn btn-right" @click="${event => this._selectResource(this.currentResourceIndex+1)}">&gt;</button>
<button class="btn btn-left" @click="${() => this._selectResource(this.currentResourceIndex-1)}">&lt;</button>
<button class="btn btn-right" @click="${() => this._selectResource(this.currentResourceIndex+1)}">&gt;</button>
</div>
<div class="resource-menu">
${this.resources.map((resource, index) => {
return html`
<figure style="margin:5px;" id="resource${index}" data-imageIndex="${index}" @click="${event => this._selectResource(index)}" class="${(index === this.currentResourceIndex) ? 'selected' : ''}">
<figure style="margin:5px;" id="resource${index}" data-imageIndex="${index}" @click="${() => this._selectResource(index)}" class="${(index === this.currentResourceIndex) ? 'selected' : ''}">
${
resource.isHass ?
html`
Expand All @@ -69,7 +69,7 @@ class GalleryCard2024 extends LitElement {
this._isImageExtension(resource.extension) ?
html`<img class="lzy_img" src="/local/community/gallery-card/placeholder.jpg" data-src="${resource.url}"/>` :
(this.config.video_preload ?? true) ?
html`<video preload="none" data-src="${resource.url}#t=${(this.config.preview_video_at === undefined) ? 0.1 : this.config.preview_video_at }" @loadedmetadata="${event => this._videoMetadataLoaded(event)}" @canplay="${event => this._downloadNextMenuVideo()}" preload="metadata"></video>` :
html`<video preload="none" data-src="${resource.url}#t=${(this.config.preview_video_at === undefined) ? 0.1 : this.config.preview_video_at }" @loadedmetadata="${event => this._videoMetadataLoaded(event)}" @canplay="${() => this._downloadNextMenuVideo()}" preload="metadata"></video>` :
html`<div style="text-align: center"><div class="lzy_img"><ha-icon id="play" icon="mdi:movie-play-outline"></ha-icon></div></div>`
}
<figcaption>${resource.caption} <span class="duration"></span></figcaption>
Expand All @@ -86,7 +86,7 @@ class GalleryCard2024 extends LitElement {
}

_downloadingVideos = false;
updated(changedProperties) {
updated() {
const imageArray = this.shadowRoot.querySelectorAll('img.lzy_img');

for (const v of imageArray) {
Expand Down Expand Up @@ -127,7 +127,7 @@ class GalleryCard2024 extends LitElement {
dayjs.extend(customParseFormat);
dayjs.extend(relativeTime);

this.imageObserver = new IntersectionObserver((entries, imgObserver) => {
this.imageObserver = new IntersectionObserver((entries) => {
for (const entry of entries) {
if (entry.isIntersecting) {
const lazyImage = entry.target;
Expand Down Expand Up @@ -236,7 +236,7 @@ class GalleryCard2024 extends LitElement {
event.target.muted = "muted";
}

_popupCamera(event_) {
_popupCamera() {
const event = new Event("hass-more-info", {
bubbles: true,
composed: true
Expand All @@ -246,7 +246,7 @@ class GalleryCard2024 extends LitElement {
this.dispatchEvent(event);
}

_popupImage(event) {
_popupImage() {
const modal = this.shadowRoot.querySelector("#imageModal");

modal.style.display = "block";
Expand Down Expand Up @@ -470,7 +470,7 @@ class GalleryCard2024 extends LitElement {
}

_loadMediaResource(hass, contentId, maximumFiles, folderFormat, fileNameFormat, fileNameDateBegins, captionFormat, recursive, reverseSort, includeVideo, includeImages, filterForDate) {
return new Promise( async (resolve, reject) => {
return new Promise((resolve) => {
let mediaPath = contentId;

try {
Expand All @@ -488,7 +488,7 @@ class GalleryCard2024 extends LitElement {

if (folder !== folderPrevious) {
try {
const folderValues = await this._loadMedia(this, hass, mediaPath, maximumFiles, false, reverseSort, includeVideo, includeImages, filterForDate);
const folderValues = this._loadMedia(this, hass, mediaPath, maximumFiles, false, reverseSort, includeVideo, includeImages, filterForDate);

values.push(...folderValues);
} catch (error) {
Expand All @@ -514,7 +514,7 @@ class GalleryCard2024 extends LitElement {
if (values.length > maximumFiles)
values.length = maximumFiles;
} else
values = await this._loadMedia(this, hass, mediaPath, maximumFiles, recursive, reverseSort, includeVideo, includeImages, filterForDate);
values = this._loadMedia(this, hass, mediaPath, maximumFiles, recursive, reverseSort, includeVideo, includeImages, filterForDate);

const resources = [];

Expand Down

0 comments on commit cb5a628

Please sign in to comment.