Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps-dev): bump eslint-config-standard from 12.0.0 to 13.0.1 #1472

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/payments.js
Expand Up @@ -2,7 +2,7 @@ const config = require('config')
const stripe = require('stripe')(config.stripe.api_secret)

exports.post = (req, res) => {
let amount = 1000
const amount = 1000

stripe.customers.create({
email: req.body.stripeEmail,
Expand Down
32 changes: 16 additions & 16 deletions app/db/config/config.js
@@ -1,24 +1,24 @@
require('dotenv').config()

module.exports = {
'development': {
'database': 'streetmix_dev',
'host': process.env.PGHOST || '127.0.0.1',
'port': process.env.PGPORT || 5432,
'dialect': 'postgres'
development: {
database: 'streetmix_dev',
host: process.env.PGHOST || '127.0.0.1',
port: process.env.PGPORT || 5432,
dialect: 'postgres'
},
'test': {
'database': 'streetmix_test',
'host': process.env.PGHOST || '127.0.0.1',
'port': process.env.PGPORT || 5432,
'dialect': 'postgres'
test: {
database: 'streetmix_test',
host: process.env.PGHOST || '127.0.0.1',
port: process.env.PGPORT || 5432,
dialect: 'postgres'
},
'staging': {
'use_env_variable': 'DATABASE_URL',
'dialect': 'postgres'
staging: {
use_env_variable: 'DATABASE_URL',
dialect: 'postgres'
},
'production': {
'use_env_variable': 'DATABASE_URL',
'dialect': 'postgres'
production: {
use_env_variable: 'DATABASE_URL',
dialect: 'postgres'
}
}
2 changes: 1 addition & 1 deletion app/db/migrations/20180729103424-create-street.js
Expand Up @@ -12,7 +12,7 @@ module.exports = {
},
status: {
type: Sequelize.ENUM,
values: [ 'ACTIVE', 'DELETED' ],
values: ['ACTIVE', 'DELETED'],
defaultValue: 'ACTIVE'
},
name: {
Expand Down
2 changes: 1 addition & 1 deletion app/db/models/street.js
Expand Up @@ -9,7 +9,7 @@ module.exports = (sequelize, DataTypes) => {
namespaced_id: DataTypes.INTEGER,
status: {
type: DataTypes.ENUM,
values: [ 'ACTIVE', 'DELETED' ],
values: ['ACTIVE', 'DELETED'],
defaultValue: 'ACTIVE'
},
name: DataTypes.STRING,
Expand Down
2 changes: 1 addition & 1 deletion app/models/__mocks__/sequence.js
Expand Up @@ -2,7 +2,7 @@

const dummySequence = {
_id: 'streets',
'__v': 0,
__v: 0,
seq: 65
}

Expand Down
2 changes: 1 addition & 1 deletion app/models/__mocks__/street.js
@@ -1,7 +1,7 @@
/* eslint-env jest */
const dummySequence = {
_id: 'streets',
'__v': 0,
__v: 0,
seq: 65
}

Expand Down
8 changes: 4 additions & 4 deletions app/models/__mocks__/user.js
@@ -1,7 +1,7 @@
/* eslint-env jest */
const mockUsers = {
user1: {
login_tokens: [ 'xxxxxxxx-xxxx-xxxx-xxxx-1111111111111' ],
login_tokens: ['xxxxxxxx-xxxx-xxxx-xxxx-1111111111111'],
_id: '1',
id: 'user1',
last_street_id: '3e888ae0-5f48-11e8-82e7-c3447c17015a',
Expand All @@ -15,7 +15,7 @@ const mockUsers = {
roles: []
},
user2: {
login_tokens: [ 'xxxxxxxx-xxxx-xxxx-xxxx-2222222222222' ],
login_tokens: ['xxxxxxxx-xxxx-xxxx-xxxx-2222222222222'],
_id: '2',
id: 'user2',
twitter_id: '2',
Expand All @@ -28,7 +28,7 @@ const mockUsers = {
roles: []
},
admin: {
login_tokens: [ 'xxxxxxxx-xxxx-xxxx-xxxx-3333333333333' ],
login_tokens: ['xxxxxxxx-xxxx-xxxx-xxxx-3333333333333'],
_id: '3',
id: 'admin',
twitter_id: '3',
Expand All @@ -38,7 +38,7 @@ const mockUsers = {
},
updated_at: '2018-05-22T14:18:09.853Z',
created_at: '2018-05-21T19:35:10.807Z',
roles: [ 'ADMIN' ]
roles: ['ADMIN']
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/models/street.js
Expand Up @@ -5,7 +5,7 @@ const User = require('./user.js')
const streetSchema = new mongoose.Schema({
id: { type: String, index: { unique: true } },
namespaced_id: { type: Number, index: true },
status: { type: String, enum: [ 'ACTIVE', 'DELETED' ], default: 'ACTIVE' },
status: { type: String, enum: ['ACTIVE', 'DELETED'], default: 'ACTIVE' },
name: String,
creator_id: {
type: mongoose.Schema.ObjectId,
Expand Down
24 changes: 12 additions & 12 deletions app/models/street_data.js
Expand Up @@ -40,7 +40,7 @@ function incrementSchemaVersion (street) {
}
break
case 4:
for (let i in street.segments) {
for (const i in street.segments) {
segment = street.segments[i]
if (segment.type === 'sidewalk-lamp') {
variant = getVariantArray(segment.type, segment.variantString)
Expand All @@ -50,7 +50,7 @@ function incrementSchemaVersion (street) {
}
break
case 5:
for (let i in street.segments) {
for (const i in street.segments) {
segment = street.segments[i]
if (segment.type === 'streetcar') {
variant = getVariantArray(segment.type, segment.variantString)
Expand All @@ -60,7 +60,7 @@ function incrementSchemaVersion (street) {
}
break
case 6:
for (let i in street.segments) {
for (const i in street.segments) {
segment = street.segments[i]
if (segment.type === 'bus-lane') {
variant = getVariantArray(segment.type, segment.variantString)
Expand All @@ -74,7 +74,7 @@ function incrementSchemaVersion (street) {
}
break
case 7:
for (let i in street.segments) {
for (const i in street.segments) {
segment = street.segments[i]
if (segment.type === 'bike-lane') {
variant = getVariantArray(segment.type, segment.variantString)
Expand All @@ -84,7 +84,7 @@ function incrementSchemaVersion (street) {
}
break
case 8:
for (let i in street.segments) {
for (const i in street.segments) {
segment = street.segments[i]
if (segment.type === 'drive-lane') {
variant = getVariantArray(segment.type, segment.variantString)
Expand All @@ -94,7 +94,7 @@ function incrementSchemaVersion (street) {
}
break
case 9:
for (let i in street.segments) {
for (const i in street.segments) {
segment = street.segments[i]
if (segment.type === 'sidewalk') {
variant = getVariantArray(segment.type, segment.variantString)
Expand All @@ -104,7 +104,7 @@ function incrementSchemaVersion (street) {
}
break
case 10:
for (let i in street.segments) {
for (const i in street.segments) {
segment = street.segments[i]
if (segment.type === 'planting-strip') {
segment.type = 'divider'
Expand All @@ -119,7 +119,7 @@ function incrementSchemaVersion (street) {
}
break
case 11:
for (let i in street.segments) {
for (const i in street.segments) {
segment = street.segments[i]
if (segment.type === 'divider') {
if (segment.variantString === 'small-tree') {
Expand All @@ -133,7 +133,7 @@ function incrementSchemaVersion (street) {
}
break
case 12:
for (let i in street.segments) {
for (const i in street.segments) {
segment = street.segments[i]
if (segment.type === 'sidewalk-bike-rack') {
variant = getVariantArray(segment.type, segment.variantString)
Expand All @@ -143,7 +143,7 @@ function incrementSchemaVersion (street) {
}
break
case 13:
for (let i in street.segments) {
for (const i in street.segments) {
segment = street.segments[i]
if (segment.type === 'sidewalk-wayfinding') {
variant = getVariantArray(segment.type, segment.variantString)
Expand All @@ -153,7 +153,7 @@ function incrementSchemaVersion (street) {
}
break
case 14:
for (let i in street.segments) {
for (const i in street.segments) {
segment = street.segments[i]
if (segment.type === 'sidewalk') {
segment.randSeed = 35
Expand All @@ -163,7 +163,7 @@ function incrementSchemaVersion (street) {
case 15:
break
case 16:
for (let i in street.segments) {
for (const i in street.segments) {
segment = street.segments[i]
if (segment.type === 'bike-lane') {
variant = getVariantArray(segment.type, segment.variantString)
Expand Down
4 changes: 2 additions & 2 deletions app/models/user.js
Expand Up @@ -6,14 +6,14 @@ const userSchema = new mongoose.Schema({
twitter_credentials: mongoose.Schema.Types.Mixed,
auth0_id: String,
email: { type: String, index: { unique: true, sparse: true } },
login_tokens: [ String ],
login_tokens: [String],
profile_image_url: String,
data: mongoose.Schema.Types.Mixed,
created_at: Date,
updated_at: Date,
last_street_id: Number,
flags: mongoose.Schema.Types.Mixed,
roles: [ String ]
roles: [String]
})

userSchema.pre('save', function (next) {
Expand Down
4 changes: 2 additions & 2 deletions app/resources/v1/flags.js
Expand Up @@ -24,15 +24,15 @@ async function readFlags (res) {
function sendSuccessResponse (res, flags) {
res.set({
'Content-Type': 'application/json; charset=utf-8',
'Location': config.restapi.baseuri + '/v1/flags',
Location: config.restapi.baseuri + '/v1/flags',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't realize we'd be as affected as we are by inconsistent quotation marks. I know there's some discussion here.

We could override standard's rule with eslint's consistent-as-needed rule, but the tradeoffs here are the addition of one more rule override and the need to re-quote entire objects if just one property is introduced that requires quotes.

@whitmanschorn do you have an opinion?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'm fine with this way, since it means putting quotes around a key is a good indicator that the key name has a non-standard character. Happy to do it either way, though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, we'll take the path of least resistance here.

'Cache-Control': 'max-age=86400'
})

res.status(200).send(flags)
}

exports.get = async function (req, res) {
let flags = await readFlags(res)
const flags = await readFlags(res)

if (flags) {
sendSuccessResponse(res, flags)
Expand Down
15 changes: 7 additions & 8 deletions app/resources/v1/streets.js
Expand Up @@ -32,12 +32,12 @@ exports.post = async function (req, res) {
try {
if (street.creator_id) {
const row = await User.findByIdAndUpdate(street.creator_id,
{ $inc: { 'last_street_id': 1 } },
{ $inc: { last_street_id: 1 } },
{ new: true, upsert: true })
namespacedId = (row) ? row.last_street_id : null
} else {
const row = await Sequence.findByIdAndUpdate('streets',
{ $inc: { 'seq': 1 } },
{ $inc: { seq: 1 } },
{ new: true, upsert: true })
namespacedId = (row) ? row.seq : null
}
Expand Down Expand Up @@ -112,7 +112,7 @@ exports.post = async function (req, res) {
if (req.loginToken) {
let user
try {
user = await User.findOne({ login_tokens: { $in: [ req.loginToken ] } })
user = await User.findOne({ login_tokens: { $in: [req.loginToken] } })
} catch (err) {
logger.error(err)
handleErrors(ERRORS.USER_NOT_FOUND)
Expand Down Expand Up @@ -147,7 +147,7 @@ exports.delete = async function (req, res) {
async function deleteStreet (street) {
let user
try {
user = await User.findOne({ login_tokens: { $in: [ req.loginToken ] } })
user = await User.findOne({ login_tokens: { $in: [req.loginToken] } })
} catch (err) {
logger.error(err)
throw new Error(ERRORS.USER_NOT_FOUND)
Expand Down Expand Up @@ -327,9 +327,8 @@ exports.find = function (req, res) {
}

if (start + streets.length < totalNumStreets) {
let nextStart, nextCount
nextStart = start + count
nextCount = Math.min(count, totalNumStreets - start - streets.length)
const nextStart = start + count
const nextCount = Math.min(count, totalNumStreets - start - streets.length)
json.meta.links.next = config.restapi.baseuri + '/v1/streets?start=' + nextStart + '&count=' + nextCount
}

Expand Down Expand Up @@ -431,7 +430,7 @@ exports.put = async function (req, res) {
async function updateStreetWithCreatorId (street) {
let user
try {
user = await User.findOne({ login_tokens: { $in: [ req.loginToken ] } })
user = await User.findOne({ login_tokens: { $in: [req.loginToken] } })
} catch (err) {
logger.error(err)
handleErrors(ERRORS.CANNOT_UPDATE_STREET)
Expand Down
13 changes: 6 additions & 7 deletions app/resources/v1/streets_pg.js
Expand Up @@ -139,7 +139,7 @@ exports.post = async function (req, res) {
let user
try {
user = await User.findOne({
where: { login_tokens: { [Op.contains]: [ req.loginToken ] } }
where: { login_tokens: { [Op.contains]: [req.loginToken] } }
})
} catch (err) {
logger.error(err)
Expand Down Expand Up @@ -176,7 +176,7 @@ exports.delete = async function (req, res) {
let user
try {
user = await User.findOne({
where: { login_tokens: { [Op.contains]: [ req.loginToken ] } }
where: { login_tokens: { [Op.contains]: [req.loginToken] } }
})
} catch (err) {
logger.error(err)
Expand Down Expand Up @@ -307,7 +307,7 @@ exports.find = async function (req, res) {
const findStreets = async function (start, count) {
return Street.findAndCountAll({
where: { status: 'ACTIVE' },
order: [ ['updated_at', 'DESC'] ],
order: [['updated_at', 'DESC']],
offset: start,
limit: count
})
Expand Down Expand Up @@ -378,9 +378,8 @@ exports.find = async function (req, res) {
}

if (start + streets.length < totalNumStreets) {
let nextStart, nextCount
nextStart = start + count
nextCount = Math.min(count, totalNumStreets - start - streets.length)
const nextStart = start + count
const nextCount = Math.min(count, totalNumStreets - start - streets.length)
json.meta.links.next = config.restapi.baseuri + '/v1/streets?start=' + nextStart + '&count=' + nextCount
}
res.status(200).send(json)
Expand Down Expand Up @@ -484,7 +483,7 @@ exports.put = async function (req, res) {
let user
try {
user = await User.findOne({
where: { login_tokens: { [Op.contains]: [ req.loginToken ] } }
where: { login_tokens: { [Op.contains]: [req.loginToken] } }
})
} catch (err) {
logger.error(err)
Expand Down
2 changes: 1 addition & 1 deletion app/resources/v1/translate.js
Expand Up @@ -27,7 +27,7 @@ async function getLocalTranslation (res, locale, resource) {
function sendSuccessResponse (res, locale, resource, translation) {
res.set({
'Content-Type': 'application/json; charset=utf-8',
'Location': config.restapi.baseuri + '/v1/translate/' + locale + '/' + resource,
Location: config.restapi.baseuri + '/v1/translate/' + locale + '/' + resource,
'Cache-Control': 'max-age=86400'
})

Expand Down
2 changes: 1 addition & 1 deletion app/resources/v1/user.js
Expand Up @@ -34,7 +34,7 @@ exports.get = async function (req, res) {

const findUserByLoginToken = async function (loginToken) {
try {
requestUser = await User.findOne({ login_tokens: { $in: [ loginToken ] } })
requestUser = await User.findOne({ login_tokens: { $in: [loginToken] } })
} catch (err) {
logger.error(err)
throw new Error(ERRORS.CANNOT_GET_USER)
Expand Down