From b061a14e15bc4a6f1e679f1f56b8ec0393ae4cd9 Mon Sep 17 00:00:00 2001 From: Gusted Date: Sat, 24 Aug 2024 18:23:54 +0200 Subject: [PATCH] [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 aa2950762e..06437657ae 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 352d085731..3f6e4e4638 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;