Merge pull request #3496 from overleaf/ae-eslint-dot-notation
Enable the eslint dot-notation rule GitOrigin-RevId: e11cbad3e8a77a4a60590d3674fbf34feccc5bc9
This commit is contained in:
@@ -296,7 +296,7 @@ const AuthenticationController = {
|
||||
return next()
|
||||
}
|
||||
|
||||
if (req.headers['authorization'] != null) {
|
||||
if (req.headers.authorization != null) {
|
||||
AuthenticationController.httpAuth(req, res, next)
|
||||
} else if (AuthenticationController.isUserLoggedIn(req)) {
|
||||
next()
|
||||
|
||||
@@ -111,8 +111,8 @@ const FileStoreHandler = {
|
||||
|
||||
getFileStream(projectId, fileId, query, callback) {
|
||||
let queryString = ''
|
||||
if (query != null && query['format'] != null) {
|
||||
queryString = `?format=${query['format']}`
|
||||
if (query != null && query.format != null) {
|
||||
queryString = `?format=${query.format}`
|
||||
}
|
||||
const opts = {
|
||||
method: 'get',
|
||||
@@ -120,10 +120,10 @@ const FileStoreHandler = {
|
||||
timeout: FIVE_MINS_IN_MS,
|
||||
headers: {}
|
||||
}
|
||||
if (query != null && query['range'] != null) {
|
||||
const rangeText = query['range']
|
||||
if (query != null && query.range != null) {
|
||||
const rangeText = query.range
|
||||
if (rangeText && rangeText.match != null && rangeText.match(/\d+-\d+/)) {
|
||||
opts.headers['range'] = `bytes=${query['range']}`
|
||||
opts.headers.range = `bytes=${query.range}`
|
||||
}
|
||||
}
|
||||
const readStream = request(opts)
|
||||
|
||||
@@ -30,7 +30,7 @@ module.exports = {
|
||||
|
||||
const userId = AuthenticationController.getLoggedInUserId(req)
|
||||
url = `/user/${userId}${url}`
|
||||
req.headers['Host'] = Settings.apis.spelling.host
|
||||
req.headers.Host = Settings.apis.spelling.host
|
||||
return request({
|
||||
url: Settings.apis.spelling.url + url,
|
||||
method: req.method,
|
||||
|
||||
@@ -208,29 +208,26 @@ const FeaturesUpdater = {
|
||||
// Special merging logic for non-boolean features
|
||||
if (key === 'compileGroup') {
|
||||
if (
|
||||
features['compileGroup'] === 'priority' ||
|
||||
featuresB['compileGroup'] === 'priority'
|
||||
features.compileGroup === 'priority' ||
|
||||
featuresB.compileGroup === 'priority'
|
||||
) {
|
||||
features['compileGroup'] = 'priority'
|
||||
features.compileGroup = 'priority'
|
||||
} else {
|
||||
features['compileGroup'] = 'standard'
|
||||
features.compileGroup = 'standard'
|
||||
}
|
||||
} else if (key === 'collaborators') {
|
||||
if (
|
||||
features['collaborators'] === -1 ||
|
||||
featuresB['collaborators'] === -1
|
||||
) {
|
||||
features['collaborators'] = -1
|
||||
if (features.collaborators === -1 || featuresB.collaborators === -1) {
|
||||
features.collaborators = -1
|
||||
} else {
|
||||
features['collaborators'] = Math.max(
|
||||
features['collaborators'] || 0,
|
||||
featuresB['collaborators'] || 0
|
||||
features.collaborators = Math.max(
|
||||
features.collaborators || 0,
|
||||
featuresB.collaborators || 0
|
||||
)
|
||||
}
|
||||
} else if (key === 'compileTimeout') {
|
||||
features['compileTimeout'] = Math.max(
|
||||
features['compileTimeout'] || 0,
|
||||
featuresB['compileTimeout'] || 0
|
||||
features.compileTimeout = Math.max(
|
||||
features.compileTimeout || 0,
|
||||
featuresB.compileTimeout || 0
|
||||
)
|
||||
} else {
|
||||
// Boolean keys, true is better
|
||||
|
||||
@@ -992,18 +992,18 @@ const RecurlyWrapper = {
|
||||
_parseXml(xml, callback) {
|
||||
var convertDataTypes = function(data) {
|
||||
let key, value
|
||||
if (data != null && data['$'] != null) {
|
||||
if (data['$']['nil'] === 'nil') {
|
||||
if (data != null && data.$ != null) {
|
||||
if (data.$.nil === 'nil') {
|
||||
data = null
|
||||
} else if (data['$'].href != null) {
|
||||
data.url = data['$'].href
|
||||
delete data['$']
|
||||
} else if (data['$']['type'] === 'integer') {
|
||||
data = parseInt(data['_'], 10)
|
||||
} else if (data['$']['type'] === 'datetime') {
|
||||
data = new Date(data['_'])
|
||||
} else if (data['$']['type'] === 'array') {
|
||||
delete data['$']
|
||||
} else if (data.$.href != null) {
|
||||
data.url = data.$.href
|
||||
delete data.$
|
||||
} else if (data.$.type === 'integer') {
|
||||
data = parseInt(data._, 10)
|
||||
} else if (data.$.type === 'datetime') {
|
||||
data = new Date(data._)
|
||||
} else if (data.$.type === 'array') {
|
||||
delete data.$
|
||||
let array = []
|
||||
for (key in data) {
|
||||
value = data[key]
|
||||
|
||||
@@ -17,7 +17,7 @@ function sendConfirmationEmail(userId, email, emailTemplate, callback) {
|
||||
|
||||
// when force-migrating accounts to v2 from v1, we don't want to send confirmation messages -
|
||||
// setting this env var allows us to turn this behaviour off
|
||||
if (process.env['SHARELATEX_NO_CONFIRMATION_MESSAGES'] != null) {
|
||||
if (process.env.SHARELATEX_NO_CONFIRMATION_MESSAGES != null) {
|
||||
return callback(null)
|
||||
}
|
||||
|
||||
|
||||
@@ -189,7 +189,7 @@ async function confirmEmail(userId, email) {
|
||||
}
|
||||
|
||||
if (Features.hasFeature('affiliations')) {
|
||||
update['$unset'] = {
|
||||
update.$unset = {
|
||||
'emails.$.affiliationUnchecked': 1
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ const UserMembershipsHandler = {
|
||||
callback = function(error) {}
|
||||
}
|
||||
const removeOperation = { $pull: {} }
|
||||
removeOperation['$pull'][entityConfig.fields.write] = userId
|
||||
removeOperation.$pull[entityConfig.fields.write] = userId
|
||||
return EntityModels[entityConfig.modelName].updateMany(
|
||||
{},
|
||||
removeOperation,
|
||||
|
||||
Reference in New Issue
Block a user