mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01: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:
parent
b91cf74d14
commit
146127c474
@ -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',
|
||||
|
@ -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 }
|
||||
|
@ -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'
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user