From 9272425bab271462cbff74ea6478e483aed6f8af Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sat, 24 Aug 2024 16:04:20 +0000 Subject: [PATCH 1/2] Update dependency eslint-plugin-unicorn to v55 --- package-lock.json | 31 ++++++++++++++++++++++--------- package.json | 6 ++---- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1bd933181..923343a44 100644 --- a/package-lock.json +++ b/package-lock.json @@ -79,7 +79,7 @@ "eslint-plugin-playwright": "1.6.2", "eslint-plugin-regexp": "2.6.0", "eslint-plugin-sonarjs": "2.0.1", - "eslint-plugin-unicorn": "52.0.0", + "eslint-plugin-unicorn": "55.0.0", "eslint-plugin-vitest": "0.5.4", "eslint-plugin-vitest-globals": "1.5.0", "eslint-plugin-vue": "9.27.0", @@ -8957,19 +8957,19 @@ "license": "ISC" }, "node_modules/eslint-plugin-unicorn": { - "version": "52.0.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-52.0.0.tgz", - "integrity": "sha512-1Yzm7/m+0R4djH0tjDjfVei/ju2w3AzUGjG6q8JnuNIL5xIwsflyCooW5sfBvQp2pMYQFSWWCFONsjCax1EHng==", + "version": "55.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-55.0.0.tgz", + "integrity": "sha512-n3AKiVpY2/uDcGrS3+QsYDkjPfaOrNrsfQxU9nt5nitd9KuvVXrfAvgCO9DYPSfap+Gqjw9EOrXIsBp5tlHZjA==", "dev": true, "license": "MIT", "dependencies": { - "@babel/helper-validator-identifier": "^7.22.20", + "@babel/helper-validator-identifier": "^7.24.5", "@eslint-community/eslint-utils": "^4.4.0", - "@eslint/eslintrc": "^2.1.4", "ci-info": "^4.0.0", "clean-regexp": "^1.0.0", - "core-js-compat": "^3.34.0", + "core-js-compat": "^3.37.0", "esquery": "^1.5.0", + "globals": "^15.7.0", "indent-string": "^4.0.0", "is-builtin-module": "^3.2.1", "jsesc": "^3.0.2", @@ -8977,11 +8977,11 @@ "read-pkg-up": "^7.0.1", "regexp-tree": "^0.1.27", "regjsparser": "^0.10.0", - "semver": "^7.5.4", + "semver": "^7.6.1", "strip-indent": "^3.0.0" }, "engines": { - "node": ">=16" + "node": ">=18.18" }, "funding": { "url": "https://github.com/sindresorhus/eslint-plugin-unicorn?sponsor=1" @@ -8990,6 +8990,19 @@ "eslint": ">=8.56.0" } }, + "node_modules/eslint-plugin-unicorn/node_modules/globals": { + "version": "15.9.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-15.9.0.tgz", + "integrity": "sha512-SmSKyLLKFbSr6rptvP8izbyxJL4ILwqO9Jg23UA0sDlGlu58V59D1//I3vlc0KJphVdUR7vMjHIplYnzBxorQA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/eslint-plugin-vitest": { "version": "0.5.4", "resolved": "https://registry.npmjs.org/eslint-plugin-vitest/-/eslint-plugin-vitest-0.5.4.tgz", diff --git a/package.json b/package.json index 4199d97a7..9cda08f15 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,7 @@ "eslint-plugin-playwright": "1.6.2", "eslint-plugin-regexp": "2.6.0", "eslint-plugin-sonarjs": "2.0.1", - "eslint-plugin-unicorn": "52.0.0", + "eslint-plugin-unicorn": "55.0.0", "eslint-plugin-vitest": "0.5.4", "eslint-plugin-vitest-globals": "1.5.0", "eslint-plugin-vue": "9.27.0", @@ -96,7 +96,5 @@ "vite-string-plugin": "1.3.4", "vitest": "2.0.5" }, - "browserslist": [ - "defaults" - ] + "browserslist": ["defaults"] } From b061a14e15bc4a6f1e679f1f56b8ec0393ae4cd9 Mon Sep 17 00:00:00 2001 From: Gusted Date: Sat, 24 Aug 2024 18:23:54 +0200 Subject: [PATCH 2/2] [PORT] Unicorn eslint plugins configs Ported from https://github.com/go-gitea/gitea/pull/31766 & https://github.com/go-gitea/gitea/pull/31402 & https://github.com/go-gitea/gitea/pull/30840 --- .eslintrc.yaml | 7 +++++++ web_src/js/components/DiffCommitSelector.vue | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.eslintrc.yaml b/.eslintrc.yaml index aa2950762..06437657a 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -705,6 +705,7 @@ rules: unicorn/better-regex: [0] unicorn/catch-error-name: [0] unicorn/consistent-destructuring: [2] + unicorn/consistent-empty-array-spread: [2] unicorn/consistent-function-scoping: [2] unicorn/custom-error-definition: [0] unicorn/empty-brace-spaces: [2] @@ -731,10 +732,14 @@ rules: unicorn/no-for-loop: [0] unicorn/no-hex-escape: [0] unicorn/no-instanceof-array: [0] + unicorn/no-invalid-fetch-options: [2] unicorn/no-invalid-remove-event-listener: [2] unicorn/no-keyword-prefix: [0] + unicorn/no-length-as-slice-end: [2] unicorn/no-lonely-if: [2] + unicorn/no-magic-array-flat-depth: [0] unicorn/no-negated-condition: [0] + unicorn/no-negation-in-equality-check: [2] unicorn/no-nested-ternary: [0] unicorn/no-new-array: [0] unicorn/no-new-buffer: [0] @@ -799,10 +804,12 @@ rules: unicorn/prefer-set-has: [0] unicorn/prefer-set-size: [2] unicorn/prefer-spread: [0] + unicorn/prefer-string-raw: [0] unicorn/prefer-string-replace-all: [0] unicorn/prefer-string-slice: [0] unicorn/prefer-string-starts-ends-with: [2] unicorn/prefer-string-trim-start-end: [2] + unicorn/prefer-structured-clone: [2] unicorn/prefer-switch: [0] unicorn/prefer-ternary: [0] unicorn/prefer-text-content: [2] diff --git a/web_src/js/components/DiffCommitSelector.vue b/web_src/js/components/DiffCommitSelector.vue index 352d08573..3f6e4e463 100644 --- a/web_src/js/components/DiffCommitSelector.vue +++ b/web_src/js/components/DiffCommitSelector.vue @@ -132,7 +132,7 @@ export default { })); this.commits.reverse(); this.lastReviewCommitSha = results.last_review_commit_sha || null; - if (this.lastReviewCommitSha && this.commits.findIndex((x) => x.id === this.lastReviewCommitSha) === -1) { + if (this.lastReviewCommitSha && !this.commits.some((x) => x.id === this.lastReviewCommitSha)) { // the lastReviewCommit is not available (probably due to a force push) // reset the last review commit sha this.lastReviewCommitSha = null;