diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index a124f5e..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1,77 +0,0 @@ -module.exports = { - //parser: '@babel/eslint-parser', // Specifies the ESLint parser - extends: [ - '@eslint-recommended', // Uses the recommended rules from eslint-plugin - 'eslint-config-prettier', // Uses eslint-config-prettier to disable ESLint rules from eslint-plugin that would conflict with prettier - //'plugin:prettier/recommended', // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array. - ], - parserOptions: { - ecmaVersion: 2022, // Allows for the parsing of modern ECMAScript features - sourceType: 'module', // Allows for the use of imports - experimentalDecorators: true, - }, - rules: { - "comma-dangle": ["error", "never"], - "no-cond-assign": ["error", "always"], - "no-constant-condition": "error", - "no-unused-vars": "error", - "consistent-return": 2, - "eqeqeq": [2, "smart"], - "guard-for-in": 2, - "lines-around-comment": [ - 2, - { - "beforeBlockComment": true, - "allowBlockStart": true - } - ], - "max-nested-callbacks": [2, 3], - "newline-after-var": 2, - "no-alert": 2, - "no-array-constructor": 2, - "no-caller": 2, - "no-catch-shadow": 2, - "no-debugger": 2, - "no-else-return": 2, - "no-eval": 2, - "no-ex-assign": 2, - "no-extend-native": 2, - "no-extra-bind": 2, - "no-extra-boolean-cast": 2, - "no-extra-parens": 2, - "no-extra-semi": 2, - "no-fallthrough": 2, - "no-floating-decimal": 2, - "no-func-assign": 2, - "no-implied-eval": 2, - "no-inner-declarations": 2, - "no-invalid-regexp": 2, - "no-lone-blocks": 2, - "no-lonely-if": 2, - "no-loop-func": 2, - "no-multi-str": 2, - "no-native-reassign": 2, - "no-negated-in-lhs": 2, - "no-new-object": 2, - "no-proto": 2, - "no-redeclare": 2, - "no-regex-spaces": 2, - "no-return-assign": 2, - "no-self-compare": 2, - "no-undef": 0, - "no-undef-init": 2, - "no-unreachable": 2, - "no-with": 2, - "operator-assignment": [2, "always"], - "semi": [2, "always"], - "semi-spacing": 2, - "strict": 2, - "use-isnan": 2, - "valid-typeof": 2, - "vars-on-top": 2, - "accessor-pairs": 0, - "sonarjs/cognitive-complexity": 0, - "unicorn/no-array-method-this-argument": 0, - "no-async-promise-executor": 0 - } -}; \ No newline at end of file diff --git a/package.json b/package.json index ce5c227..34716e0 100644 --- a/package.json +++ b/package.json @@ -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", @@ -45,8 +47,9 @@ "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", @@ -54,7 +57,7 @@ "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": { @@ -63,4 +66,4 @@ "lit-element": "^3.3.2", "lit-html": "^2.7.5" } -} \ No newline at end of file +} diff --git a/src/gallery-card-2024.js b/src/gallery-card-2024.js index 5b626dd..fb69021 100644 --- a/src/gallery-card-2024.js +++ b/src/gallery-card-2024.js @@ -28,7 +28,7 @@ class GalleryCard2024 extends LitElement { ${this.currentResourceIndex === undefined || !(this.config.enable_date_search ?? false) ? html`` : html`` } ${this.currentResourceIndex === undefined || !(this.config.show_reload ?? false) ? - html`` : html`Reload` } + html`` : html`Reload` }
${ @@ -50,13 +50,13 @@ class GalleryCard2024 extends LitElement { ${this.config.show_zoom ? html`Zoom` : html`` }
- - + +
${this.resources.map((resource, index) => { return html` -
+
${ resource.isHass ? html` @@ -69,7 +69,7 @@ class GalleryCard2024 extends LitElement { this._isImageExtension(resource.extension) ? html`` : (this.config.video_preload ?? true) ? - html`` : + html`` : html`
` }
${resource.caption}
@@ -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) { @@ -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; @@ -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 @@ -246,7 +246,7 @@ class GalleryCard2024 extends LitElement { this.dispatchEvent(event); } - _popupImage(event) { + _popupImage() { const modal = this.shadowRoot.querySelector("#imageModal"); modal.style.display = "block"; @@ -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 { @@ -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) { @@ -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 = [];