deal with no-prototype-builtins
This commit is contained in:
parent
fddb531ed2
commit
fc18673030
|
@ -361,6 +361,7 @@ const Status = {
|
||||||
return uniqBy(combinedUsers, 'id')
|
return uniqBy(combinedUsers, 'id')
|
||||||
},
|
},
|
||||||
tags () {
|
tags () {
|
||||||
|
// eslint-disable-next-line no-prototype-builtins
|
||||||
return this.status.tags.filter(tagObj => tagObj.hasOwnProperty('name')).map(tagObj => tagObj.name).join(' ')
|
return this.status.tags.filter(tagObj => tagObj.hasOwnProperty('name')).map(tagObj => tagObj.name).join(' ')
|
||||||
},
|
},
|
||||||
hidePostStats () {
|
hidePostStats () {
|
||||||
|
|
|
@ -341,6 +341,7 @@ const addNewNotifications = (state, { dispatch, notifications, older, visibleNot
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only add a new notification if we don't have one for the same action
|
// Only add a new notification if we don't have one for the same action
|
||||||
|
// eslint-disable-next-line no-prototype-builtins
|
||||||
if (!state.notifications.idStore.hasOwnProperty(notification.id)) {
|
if (!state.notifications.idStore.hasOwnProperty(notification.id)) {
|
||||||
updateNotificationsMinMaxId(state, notification)
|
updateNotificationsMinMaxId(state, notification)
|
||||||
|
|
||||||
|
|
|
@ -39,9 +39,9 @@ const qvitterStatusType = (status) => {
|
||||||
|
|
||||||
export const parseUser = (data) => {
|
export const parseUser = (data) => {
|
||||||
const output = {}
|
const output = {}
|
||||||
const masto = data.hasOwnProperty('acct')
|
const masto = Object.prototype.hasOwnProperty.call(data, 'acct')
|
||||||
// case for users in "mentions" property for statuses in MastoAPI
|
// case for users in "mentions" property for statuses in MastoAPI
|
||||||
const mastoShort = masto && !data.hasOwnProperty('avatar')
|
const mastoShort = masto && !Object.prototype.hasOwnProperty.call(data, 'avatar')
|
||||||
|
|
||||||
output.id = String(data.id)
|
output.id = String(data.id)
|
||||||
output._original = data // used for server-side settings
|
output._original = data // used for server-side settings
|
||||||
|
@ -225,7 +225,7 @@ export const parseUser = (data) => {
|
||||||
|
|
||||||
export const parseAttachment = (data) => {
|
export const parseAttachment = (data) => {
|
||||||
const output = {}
|
const output = {}
|
||||||
const masto = !data.hasOwnProperty('oembed')
|
const masto = !Object.prototype.hasOwnProperty.call(data, 'oembed')
|
||||||
|
|
||||||
if (masto) {
|
if (masto) {
|
||||||
// Not exactly same...
|
// Not exactly same...
|
||||||
|
@ -246,7 +246,7 @@ export const parseAttachment = (data) => {
|
||||||
|
|
||||||
export const parseStatus = (data) => {
|
export const parseStatus = (data) => {
|
||||||
const output = {}
|
const output = {}
|
||||||
const masto = data.hasOwnProperty('account')
|
const masto = Object.prototype.hasOwnProperty.call(data, 'account')
|
||||||
|
|
||||||
if (masto) {
|
if (masto) {
|
||||||
output.favorited = data.favourited
|
output.favorited = data.favourited
|
||||||
|
@ -374,7 +374,7 @@ export const parseNotification = (data) => {
|
||||||
favourite: 'like',
|
favourite: 'like',
|
||||||
reblog: 'repeat'
|
reblog: 'repeat'
|
||||||
}
|
}
|
||||||
const masto = !data.hasOwnProperty('ntype')
|
const masto = !Object.prototype.hasOwnProperty.call(data, 'ntype')
|
||||||
const output = {}
|
const output = {}
|
||||||
|
|
||||||
if (masto) {
|
if (masto) {
|
||||||
|
|
|
@ -26,6 +26,7 @@ export class RegistrationError extends Error {
|
||||||
// the error is probably a JSON object with a single key, "errors", whose value is another JSON object containing the real errors
|
// the error is probably a JSON object with a single key, "errors", whose value is another JSON object containing the real errors
|
||||||
if (typeof error === 'string') {
|
if (typeof error === 'string') {
|
||||||
error = JSON.parse(error)
|
error = JSON.parse(error)
|
||||||
|
// eslint-disable-next-line
|
||||||
if (error.hasOwnProperty('error')) {
|
if (error.hasOwnProperty('error')) {
|
||||||
error = JSON.parse(error.error)
|
error = JSON.parse(error.error)
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ describe('routes', () => {
|
||||||
|
|
||||||
const matchedComponents = router.currentRoute.value.matched
|
const matchedComponents = router.currentRoute.value.matched
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-prototype-builtins
|
||||||
expect(matchedComponents[0].components.default.components.hasOwnProperty('Timeline')).to.eql(true)
|
expect(matchedComponents[0].components.default.components.hasOwnProperty('Timeline')).to.eql(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -27,6 +28,7 @@ describe('routes', () => {
|
||||||
|
|
||||||
const matchedComponents = router.currentRoute.value.matched
|
const matchedComponents = router.currentRoute.value.matched
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-prototype-builtins
|
||||||
expect(matchedComponents[0].components.default.components.hasOwnProperty('UserCard')).to.eql(true)
|
expect(matchedComponents[0].components.default.components.hasOwnProperty('UserCard')).to.eql(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -35,6 +37,7 @@ describe('routes', () => {
|
||||||
|
|
||||||
const matchedComponents = router.currentRoute.value.matched
|
const matchedComponents = router.currentRoute.value.matched
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-prototype-builtins
|
||||||
expect(matchedComponents[0].components.default.components.hasOwnProperty('UserCard')).to.eql(true)
|
expect(matchedComponents[0].components.default.components.hasOwnProperty('UserCard')).to.eql(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -6,7 +6,7 @@ const checkColors = (output) => {
|
||||||
expect(v, key).to.be.an('object')
|
expect(v, key).to.be.an('object')
|
||||||
expect(v, key).to.include.all.keys('r', 'g', 'b')
|
expect(v, key).to.include.all.keys('r', 'g', 'b')
|
||||||
'rgba'.split('').forEach(k => {
|
'rgba'.split('').forEach(k => {
|
||||||
if ((k === 'a' && v.hasOwnProperty('a')) || k !== 'a') {
|
if ((k === 'a' && Object.prototype.hasOwnProperty.call(v, 'a')) || k !== 'a') {
|
||||||
expect(v[k], key + '.' + k).to.be.a('number')
|
expect(v[k], key + '.' + k).to.be.a('number')
|
||||||
expect(v[k], key + '.' + k).to.be.least(0)
|
expect(v[k], key + '.' + k).to.be.least(0)
|
||||||
expect(v[k], key + '.' + k).to.be.most(k === 'a' ? 1 : 255)
|
expect(v[k], key + '.' + k).to.be.most(k === 'a' ? 1 : 255)
|
||||||
|
|
Loading…
Reference in New Issue