From 723584dd4f6ac33936631e2becc925cda9496a41 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Wed, 24 Aug 2022 16:46:26 +0200 Subject: [PATCH] Enable the `unicorn/prefer-array-find` ESLint plugin rule Please find additional information here: - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find#browser_compatibility - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-find.md --- .eslintrc | 1 + test/test.js | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.eslintrc b/.eslintrc index 0f68fcd6d..979e2156a 100644 --- a/.eslintrc +++ b/.eslintrc @@ -49,6 +49,7 @@ "unicorn/no-instanceof-array": "error", "unicorn/no-new-buffer": "error", "unicorn/no-useless-spread": "error", + "unicorn/prefer-array-find": "error", "unicorn/prefer-array-flat": "error", "unicorn/prefer-array-flat-map": "error", "unicorn/prefer-array-index-of": "error", diff --git a/test/test.js b/test/test.js index c3346e8f2..8d8c7acf9 100644 --- a/test/test.js +++ b/test/test.js @@ -1027,9 +1027,7 @@ function stopServer() { } function getSession(browser) { - return sessions.filter(function (session) { - return session.name === browser; - })[0]; + return sessions.find(session => session.name === browser); } async function closeSession(browser) {