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.
feature/default_network_editable
Whymarrh Whitby 4 years ago committed by GitHub
parent b91cf74d14
commit 146127c474
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      .eslintrc.js
  2. 4
      app/scripts/lib/ComposableObservableStore.js
  3. 2
      app/scripts/lib/get-first-preferred-lang-code.js

@ -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…
Cancel
Save