From 394ecd9f4df70b0f7a74b1bb78a0490be4079023 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 28 Dec 2020 18:11:57 +0000 Subject: [PATCH 1/3] Update dependency eslint-plugin-unicorn to v25 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 3d1a2df7695..846a9efd6d0 100644 --- a/package.json +++ b/package.json @@ -111,7 +111,7 @@ "eslint-plugin-ember-concurrency": "0.2.1", "eslint-plugin-import-helpers": "1.1.0", "eslint-plugin-prettier": "3.3.0", - "eslint-plugin-unicorn": "24.0.0", + "eslint-plugin-unicorn": "25.0.0", "loader.js": "4.7.0", "normalize.css": "8.0.1", "nyc": "15.1.0", diff --git a/yarn.lock b/yarn.lock index 3031e6e8288..b45e44fa42d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7390,10 +7390,10 @@ eslint-plugin-prettier@3.3.0: dependencies: prettier-linter-helpers "^1.0.0" -eslint-plugin-unicorn@24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-unicorn/-/eslint-plugin-unicorn-24.0.0.tgz#08017ccd7ac704777d459cff6e13a35f54cbcab1" - integrity sha512-NfLjIZas/ZUwc3S+pUtbTRqgCkODxPEkJBJ5ZR8wIu90BmX4jmXp10hoOZMScR2CR1NYTtrx0OX4BQvBnbzZzA== +eslint-plugin-unicorn@25.0.0: + version "25.0.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-unicorn/-/eslint-plugin-unicorn-25.0.0.tgz#b5718381ac615f2bcf7814e4acf0aac78b11a10f" + integrity sha512-RuhPUrsKuRj0YGz8lMuh5Z5DJoC/hmUR6omvlquLlY6SYY+oZXMFyp83ckpqLMhbafqUx+JttWOPOjfP4W9Y+Q== dependencies: ci-info "^2.0.0" clean-regexp "^1.0.0" From 12e5b5258ba4885b20fbd1d5c5003851dd8125f9 Mon Sep 17 00:00:00 2001 From: Tobias Bieniek Date: Mon, 28 Dec 2020 21:17:21 +0100 Subject: [PATCH 2/3] ESLint: Adjust `unicorn` rule names --- .eslintrc.js | 2 +- mirage/route-handlers/summary.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index afeb7948697..fc069ea6d0c 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -84,7 +84,7 @@ module.exports = { files: ['mirage/**/*.js'], rules: { // disabled because of different `.find()` meaning - 'unicorn/no-fn-reference-in-iterator': 'off', + 'unicorn/no-array-callback-reference': 'off', }, }, diff --git a/mirage/route-handlers/summary.js b/mirage/route-handlers/summary.js index 881f19cfc88..d21ea0352e4 100644 --- a/mirage/route-handlers/summary.js +++ b/mirage/route-handlers/summary.js @@ -9,7 +9,7 @@ export function summary(schema) { let most_recently_downloaded = crates.sort((a, b) => b.recent_downloads - a.recent_downloads).slice(0, 10); let num_crates = crates.length; - // eslint-disable-next-line unicorn/no-reduce + // eslint-disable-next-line unicorn/no-array-reduce let num_downloads = crates.models.reduce((sum, crate) => sum + crate.downloads, 0); let popular_categories = schema.categories From 9ee61a48f1fb7c62f9e65faf8e422e6eeca0d262 Mon Sep 17 00:00:00 2001 From: Tobias Bieniek Date: Mon, 28 Dec 2020 21:31:23 +0100 Subject: [PATCH 3/3] ESLint: Explicitly configure `unicorn/explicit-length-check` rule --- .eslintrc.js | 1 + app/controllers/crate/version.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index fc069ea6d0c..ec7ba367ffa 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -38,6 +38,7 @@ module.exports = { 'ember-concurrency/no-perform-without-catch': 'warn', 'ember-concurrency/require-task-name-suffix': 'error', + 'unicorn/explicit-length-check': ['error', { 'non-zero': 'not-equal' }], // disabled because we need `null` since JSON has no `undefined` 'unicorn/no-null': 'off', // disabled because this rule conflicts with prettier diff --git a/app/controllers/crate/version.js b/app/controllers/crate/version.js index 4b77313027b..7a8d89aaa7b 100644 --- a/app/controllers/crate/version.js +++ b/app/controllers/crate/version.js @@ -81,7 +81,7 @@ export default class CrateVersionController extends Controller { versions.push(version.getProperties('id', 'num')); }); } - if (extra.length > 0) { + if (extra.length !== 0) { versions.push({ id: null, num: 'Other', @@ -136,7 +136,7 @@ export default class CrateVersionController extends Controller { // if we know about a successful docs.rs build, we'll return a link to that if (this.loadDocsBuildsTask.lastSuccessful) { let docsBuilds = this.loadDocsBuildsTask.lastSuccessful.value; - if (docsBuilds.length > 0 && docsBuilds[0].build_status === true) { + if (docsBuilds.length !== 0 && docsBuilds[0].build_status === true) { return `https://docs.rs/${this.crate.name}/${this.currentVersion.num}`; } }