From 131e6403ccd59693e8498d175acba4fdd28268b9 Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Sun, 29 Jan 2023 21:07:51 -0500 Subject: [PATCH] Update hasOwnProperty calls for ESLint (#23307) --- .eslintrc.js | 1 - app/javascript/mastodon/features/emoji/emoji_utils.js | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 03af2975b..e728a7f14 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -81,7 +81,6 @@ module.exports = { ], 'no-empty': 'off', 'no-nested-ternary': 'warn', - 'no-prototype-builtins': 'off', 'no-restricted-properties': [ 'error', { property: 'substring', message: 'Use .slice instead of .substring.' }, diff --git a/app/javascript/mastodon/features/emoji/emoji_utils.js b/app/javascript/mastodon/features/emoji/emoji_utils.js index dbf725c1f..571907a50 100644 --- a/app/javascript/mastodon/features/emoji/emoji_utils.js +++ b/app/javascript/mastodon/features/emoji/emoji_utils.js @@ -135,19 +135,19 @@ function getData(emoji, skin, set) { } } - if (data.short_names.hasOwnProperty(emoji)) { + if (Object.prototype.hasOwnProperty.call(data.short_names, emoji)) { emoji = data.short_names[emoji]; } - if (data.emojis.hasOwnProperty(emoji)) { + if (Object.prototype.hasOwnProperty.call(data.emojis, emoji)) { emojiData = data.emojis[emoji]; } } else if (emoji.id) { - if (data.short_names.hasOwnProperty(emoji.id)) { + if (Object.prototype.hasOwnProperty.call(data.short_names, emoji.id)) { emoji.id = data.short_names[emoji.id]; } - if (data.emojis.hasOwnProperty(emoji.id)) { + if (Object.prototype.hasOwnProperty.call(data.emojis, emoji.id)) { emojiData = data.emojis[emoji.id]; skin = skin || emoji.skin; } @@ -216,7 +216,7 @@ function deepMerge(a, b) { let originalValue = a[key], value = originalValue; - if (b.hasOwnProperty(key)) { + if (Object.prototype.hasOwnProperty.call(b, key)) { value = b[key]; }