1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 11:22:43 +02:00

Fix no-prototype-builtins issues (#9213)

See [`no-prototype-builtins`](https://eslint.org/docs/rules/no-prototype-builtins) for more information.

This change enables `no-prototype-builtins` and fixes the issues raised by the rule.
This commit is contained in:
Whymarrh Whitby 2020-08-13 18:04:51 -02:30 committed by GitHub
parent b91cf74d14
commit 146127c474
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 3 deletions

View File

@ -57,6 +57,7 @@ module.exports = {
'no-loop-func': 'error',
'no-nested-ternary': 'error',
'no-plusplus': ['error', { 'allowForLoopAfterthoughts': true }],
'no-prototype-builtins': 'error',
'no-useless-catch': 'error',
'no-useless-concat': 'error',
'prefer-spread': 'error',

View File

@ -25,7 +25,7 @@ export default class ComposableObservableStore extends ObservableStore {
this.config = config
this.removeAllListeners()
for (const key in config) {
if (config.hasOwnProperty(key)) {
if (Object.prototype.hasOwnProperty.call(config, key)) {
config[key].subscribe((state) => {
this.updateState({ [key]: state })
})
@ -42,7 +42,7 @@ export default class ComposableObservableStore extends ObservableStore {
getFlatState () {
let flatState = {}
for (const key in this.config) {
if (this.config.hasOwnProperty(key)) {
if (Object.prototype.hasOwnProperty.call(this.config, key)) {
const controller = this.config[key]
const state = controller.getState ? controller.getState() : controller.state
flatState = { ...flatState, ...state }

View File

@ -40,7 +40,7 @@ export default async function getFirstPreferredLangCode () {
const firstPreferredLangCode = userPreferredLocaleCodes
.map((code) => code.toLowerCase().replace('_', '-'))
.find((code) => existingLocaleCodes.hasOwnProperty(code))
.find((code) => Object.prototype.hasOwnProperty.call(existingLocaleCodes, code))
return existingLocaleCodes[firstPreferredLangCode] || 'en'
}