styling: standard.js enforcement.

This commit is contained in:
41666 2019-02-25 00:44:59 -06:00
parent b8da886601
commit 11cf1d4805
9 changed files with 17 additions and 19 deletions

4
.eslintrc.json Normal file
View file

@ -0,0 +1,4 @@
{
"extends": [ "standard" ],
"parser": "babel-eslint"
}

View file

@ -1,3 +0,0 @@
{
"git.ignoreLimitWarning": true
}

View file

@ -72,7 +72,6 @@ module.exports = (R, $) => {
ctx.redirect(url)
})
R.get('/api/oauth/bot/callback', ctx => {
console.log(ctx.request)
})

View file

@ -39,7 +39,7 @@ module.exports = (R, $) => {
})
R.get('/api/server/:id/slug', async (ctx) => {
const { userId } = ctx.session
// const { userId } = ctx.session
const { id } = ctx.params
const srv = $.discord.client.guilds.get(id)

View file

@ -3,7 +3,6 @@ module.exports = (R, $) => {
// ctx.body = 'ok'
const srv = $.discord.getRelevantServers(ctx.params.user)
ctx.body = $.discord.presentableServers(srv, ctx.params.user)
return
})
R.get('/api/~/roles/:id/:userId', (ctx, next) => {

View file

@ -4,14 +4,14 @@ module.exports = (R, $) => {
const processMappings = mapping => {
for (let p in mapping) {
R.get(p, ctx => {
$.ui.render(ctx.req, ctx.res, mapping[p], {...ctx.params, ...ctx.query})
return $.ui.render(ctx.req, ctx.res, mapping[p], { ...ctx.query, ...ctx.params })
})
}
}
processMappings({
"/s/add": "/_server_add",
"/s/:id": "/_server",
"/help/:page": "/_help"
'/s/add': '/_internal/_server_add',
'/s/:id': '/_internal/_server',
'/test': '/test'
})
}

View file

@ -1,7 +1,7 @@
const log = new (require('../logger'))('models/index')
const glob = require('glob')
const path = require('path')
const util = require('../util/model-methods')
// const util = require('../util/model-methods')
module.exports = (sql) => {
const models = {}

View file

@ -13,7 +13,7 @@ class DiscordService extends Service {
this.botCallback = `${ctx.config.appUrl}/api/oauth/bot/callback`
this.appUrl = process.env.APP_URL
this.isBot = process.env.IS_BOT === 'true' || false
this.rootUsers = new Set((process.env.ROOT_USERS||'').split(','))
this.rootUsers = new Set((process.env.ROOT_USERS || '').split(','))
this.client = new discord.Client()
this.client.options.disableEveryone = true
@ -27,11 +27,11 @@ class DiscordService extends Service {
return this.gm(server, this.client.user.id)
}
fakeGm({id = 0, nickname = '[none]', displayHexColor = '#ffffff'}) {
return { id, nickname, displayHexColor, __faked: true, roles: { has() {return false} } }
fakeGm ({ id = 0, nickname = '[none]', displayHexColor = '#ffffff' }) {
return { id, nickname, displayHexColor, __faked: true, roles: { has () { return false } } }
}
isRoot(id) {
isRoot (id) {
return this.rootUsers.has(id)
}
@ -191,7 +191,7 @@ class DiscordService extends Service {
}
]
// prefix regex with ^ for ease of code
.map(({regex, ...rest}) => ({ regex: new RegExp(`^${regex.source}`, regex.flags), ...rest }))
.map(({ regex, ...rest }) => ({ regex: new RegExp(`^${regex.source}`, regex.flags), ...rest }))
return cmds
}
@ -235,7 +235,6 @@ class DiscordService extends Service {
async handleJoin (guild) {
await this.ctx.server.ensure(guild)
}
}
module.exports = DiscordService

View file

@ -6,7 +6,7 @@ class SessionsService extends Service {
this.Session = ctx.M.Session
}
async get (id, {rolling}) {
async get (id, { rolling }) {
const user = await this.Session.findOne({ where: { id } })
if (user === null) {
@ -16,7 +16,7 @@ class SessionsService extends Service {
return user.data
}
async set (id, data, {maxAge, rolling, changed}) {
async set (id, data, { maxAge, rolling, changed }) {
let session = await this.Session.findOne({ where: { id } })
if (session === null) {
session = this.Session.build({ id })