From 170256c20fdd6d228d0f873d9e9d55e8481ce855 Mon Sep 17 00:00:00 2001 From: Christopher Willis-Ford <7019101+cwillisf@users.noreply.github.com> Date: Mon, 26 Feb 2024 13:35:15 -0800 Subject: [PATCH] style: fix no-prototype-builtins violations --- src/components/helpwidget/helpwidget.jsx | 2 +- src/components/join-flow/email-step.jsx | 2 +- src/lib/scratch-wiki.js | 4 ++-- src/views/annual-report/2019/annual-report.jsx | 2 +- src/views/annual-report/2020/annual-report.jsx | 2 +- src/views/annual-report/2021/annual-report.jsx | 2 +- src/views/preview/project-view.jsx | 8 ++++---- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/components/helpwidget/helpwidget.jsx b/src/components/helpwidget/helpwidget.jsx index 992a2e07c..aa7c2a5c1 100644 --- a/src/components/helpwidget/helpwidget.jsx +++ b/src/components/helpwidget/helpwidget.jsx @@ -28,7 +28,7 @@ const freshdeskLocale = locale => { 'zh-cn': 'zh-CN', 'zh-tw': 'zh-TW' }; - if (localeMap.hasOwnProperty(locale)) { + if (Object.prototype.hasOwnProperty.call(localeMap, locale)) { return localeMap[locale]; } // locale will either be supported by Freshdesk, or will default to English if not diff --git a/src/components/join-flow/email-step.jsx b/src/components/join-flow/email-step.jsx index 8d7797f74..41638ed32 100644 --- a/src/components/join-flow/email-step.jsx +++ b/src/components/join-flow/email-step.jsx @@ -50,7 +50,7 @@ class EmailStep extends React.Component { } // simple function to memoize remote requests for usernames validateEmailRemotelyWithCache (email) { - if (this.emailRemoteCache.hasOwnProperty(email)) { + if (Object.prototype.hasOwnProperty.call(this.emailRemoteCache, email)) { return Promise.resolve(this.emailRemoteCache[email]); } // email is not in our cache diff --git a/src/lib/scratch-wiki.js b/src/lib/scratch-wiki.js index b143fdbf8..0c4f650d9 100644 --- a/src/lib/scratch-wiki.js +++ b/src/lib/scratch-wiki.js @@ -12,9 +12,9 @@ const wwwLocaleToScratchWikiLocale = { }; const getScratchWikiLink = locale => { - if (!wwwLocaleToScratchWikiLocale.hasOwnProperty(locale)) { + if (!Object.prototype.hasOwnProperty.call(wwwLocaleToScratchWikiLocale, locale)) { locale = locale.split('-')[0]; - if (!wwwLocaleToScratchWikiLocale.hasOwnProperty(locale)) { + if (!Object.prototype.hasOwnProperty.call(wwwLocaleToScratchWikiLocale, locale)) { locale = 'en'; } } diff --git a/src/views/annual-report/2019/annual-report.jsx b/src/views/annual-report/2019/annual-report.jsx index f38274b04..2cbbc2159 100644 --- a/src/views/annual-report/2019/annual-report.jsx +++ b/src/views/annual-report/2019/annual-report.jsx @@ -172,7 +172,7 @@ class AnnualReport extends React.Component { // Find which section is currently visible based on our scroll position for (const key in this.sectionRefs) { - if (!this.sectionRefs.hasOwnProperty(key)) continue; + if (!Object.prototype.hasOwnProperty.call(this.sectionRefs, key)) continue; const currentRef = this.sectionRefs[key]; const {offsetBottom, offsetTop} = this.getDimensionsOfSection(currentRef); if (currentScrollPosition > offsetTop && currentScrollPosition < offsetBottom) { diff --git a/src/views/annual-report/2020/annual-report.jsx b/src/views/annual-report/2020/annual-report.jsx index 63847a450..f9915c211 100644 --- a/src/views/annual-report/2020/annual-report.jsx +++ b/src/views/annual-report/2020/annual-report.jsx @@ -192,7 +192,7 @@ class AnnualReport extends React.Component { // Find which section is currently visible based on our scroll position for (const key in this.sectionRefs) { - if (!this.sectionRefs.hasOwnProperty(key)) continue; + if (!Object.prototype.hasOwnProperty.call(this.sectionRefs, key)) continue; const currentRef = this.sectionRefs[key]; const {offsetBottom, offsetTop} = this.getDimensionsOfSection(currentRef); if (currentScrollPosition > offsetTop && currentScrollPosition < offsetBottom) { diff --git a/src/views/annual-report/2021/annual-report.jsx b/src/views/annual-report/2021/annual-report.jsx index 4c4343e99..e7d101ff4 100644 --- a/src/views/annual-report/2021/annual-report.jsx +++ b/src/views/annual-report/2021/annual-report.jsx @@ -219,7 +219,7 @@ class AnnualReport extends React.Component { // Find which section is currently visible based on our scroll position for (const key in this.sectionRefs) { - if (!this.sectionRefs.hasOwnProperty(key)) continue; + if (!Object.prototype.hasOwnProperty.call(this.sectionRefs, key)) continue; const currentRef = this.sectionRefs[key]; const {offsetBottom, offsetTop} = this.getDimensionsOfSection(currentRef); if (currentScrollPosition > offsetTop && currentScrollPosition < offsetBottom) { diff --git a/src/views/preview/project-view.jsx b/src/views/preview/project-view.jsx index 779e89704..6e87bbc69 100644 --- a/src/views/preview/project-view.jsx +++ b/src/views/preview/project-view.jsx @@ -247,10 +247,10 @@ class Preview extends React.Component { }; const creatingProject = projectId === null || typeof projectId === 'undefined'; const queryParams = {}; - if (params.hasOwnProperty('originalId')) queryParams.original_id = params.originalId; - if (params.hasOwnProperty('isCopy')) queryParams.is_copy = params.isCopy; - if (params.hasOwnProperty('isRemix')) queryParams.is_remix = params.isRemix; - if (params.hasOwnProperty('title')) queryParams.title = params.title; + if (Object.prototype.hasOwnProperty.call(params, 'originalId')) queryParams.original_id = params.originalId; + if (Object.prototype.hasOwnProperty.call(params, 'isCopy')) queryParams.is_copy = params.isCopy; + if (Object.prototype.hasOwnProperty.call(params, 'isRemix')) queryParams.is_remix = params.isRemix; + if (Object.prototype.hasOwnProperty.call(params, 'title')) queryParams.title = params.title; let qs = queryString.stringify(queryParams); if (qs) qs = `?${qs}`; if (creatingProject) {