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

Eslint 2 @types/underscore #378

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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 28 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 17 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,29 @@
"dev": "rm -rf dist/ && tsc && cp -r public dist/public && node --inspect ./dist/app.js",
"build-binaries": "rm -rf dist/ && tsc && cp config/app.json dist/config/app.json && cp config/config.json dist/config/config.json && pkg . --target node12-alpine-x64,node12-macos-x64 --out-path binaries",
"start-ecs": "cp config/app.json dist/config/app.json && cp config/config.json dist/config/config.json && export NODE_ENV=production && node --max-old-space-size=128 dist/app.js",
"lint": "eslint ./src/*.ts ./src/**/*.ts --fix --max-warnings 517"
"lint": "eslint ./src/*.ts ./src/**/*.ts --fix --max-warnings 470"
},
"keywords": [],
"author": "",
"license": "ISC",
"ava": {
"files": ["!src/tests/utils/**", "!src/tests/types"],
"extensions": ["ts"],
"require": ["ts-node/register"]
"files": [
"!src/tests/utils/**",
"!src/tests/types"
],
"extensions": [
"ts"
],
"require": [
"ts-node/register"
]
},
"dependencies": {
"@boltz/bolt11": "^1.2.7",
"@grpc/proto-loader": "^0.5.3",
"@octokit/webhooks-types": "^5.2.0",
"@scout_apm/scout-apm": "^0.1.10",
"@types/node": "^13.5.1",
"@types/underscore": "^1.11.4",
"async": "^2.6.2",
"async-lock": "^1.2.2",
"axios": "^0.21.1",
Expand Down Expand Up @@ -102,6 +109,7 @@
"zbase32": "^1.0.2"
},
"devDependencies": {
"@types/node": "^17.0.35",
"@typescript-eslint/eslint-plugin": "^4.28.2",
"@typescript-eslint/parser": "^4.33.0",
"ava": "^3.15.0",
Expand All @@ -115,7 +123,10 @@
"socket.io-client-legacy": "npm:socket.io-client@^2.4.0"
},
"pkg": {
"assets": ["config/*", "dist/config/*"]
"assets": [
"config/*",
"dist/config/*"
]
},
"husky": {
"hooks": {
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export async function requestTransportKey(req: Req, res) {
return
}

const transportTokenKeys: { [k: string]: string } = await rsa.genKeys()
const transportTokenKeys = await rsa.genKeys()
fs.writeFileSync(config.transportPublicKeyLocation, transportTokenKeys.public)
fs.writeFileSync(
config.transportPrivateKeyLocation,
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/chatTribes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ export async function createTribeChatParams(
}

// make ts sig here w LNd pubkey - that is UUID
const keys: { [k: string]: string } = await rsa.genKeys()
const keys = await rsa.genKeys()
const groupUUID = await tribes.genSignedTimestamp(owner.publicKey)
const theContactIds = contactIds.includes(owner.id)
? contactIds
Expand Down
3 changes: 2 additions & 1 deletion src/controllers/invoices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import * as bolt11 from '@boltz/bolt11'
import { sphinxLogger } from '../utils/logger'
import { Req } from '../types'
import { Response } from 'express'
import { ChatPlusMembers } from '../network/send'

function stripLightningPrefix(s: string): string {
if (s.toLowerCase().startsWith('lightning:')) return s.substring(10)
Expand Down Expand Up @@ -202,7 +203,7 @@ export const createInvoice = async (req: Req, res: Response): Promise<void> => {
success(res, jsonUtils.messageToJson(message, chat))

network.sendMessage({
chat: chat,
chat: chat as Partial<ChatPlusMembers>,
sender: owner,
type: constants.message_types.invoice,
message: {
Expand Down
5 changes: 3 additions & 2 deletions src/controllers/media.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { loadConfig } from '../utils/config'
import { failure } from '../utils/res'
import { logging, sphinxLogger } from '../utils/logger'
import { Req } from '../types'
import { ChatPlusMembers } from '../network/send'

const config = loadConfig()

Expand Down Expand Up @@ -143,7 +144,7 @@ export const sendAttachmentMessage = async (req: Req, res) => {
if (reply_uuid) msg.replyUuid = reply_uuid
if (parent_id) msg.parentId = parent_id
network.sendMessage({
chat: chat,
chat: chat as Partial<ChatPlusMembers>,
sender: owner,
type: constants.message_types.attachment,
amount: amount || 0,
Expand Down Expand Up @@ -230,7 +231,7 @@ export const purchase = async (req: Req, res) => {
purchaser: owner.id, // for tribe, knows who sent
}
network.sendMessage({
chat: { ...chat.dataValues, contactIds: [contact_id] },
chat: { ...chat.dataValues, contactIds: JSON.stringify([ contact_id ]) },
sender: owner,
type: constants.message_types.purchase,
realSatsContactId: contact_id, // ALWAYS will be keysend, so doesnt matter if tribe owner or not
Expand Down
3 changes: 2 additions & 1 deletion src/controllers/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import * as short from 'short-uuid'
import constants from '../constants'
import { logging, sphinxLogger } from '../utils/logger'
import { Req, Res } from '../types'
import { ChatPlusMembers } from '../network/send'

// deprecated
export const getMessages = async (req: Req, res: Res): Promise<void> => {
Expand Down Expand Up @@ -383,7 +384,7 @@ export const sendMessage = async (req: Req, res: Res): Promise<void> => {
if (recipientPic) msgToSend.recipientPic = recipientPic

const sendMessageParams: SendMessageParams = {
chat: chat,
chat: chat as Partial<ChatPlusMembers>,
sender: owner,
amount: amount || 0,
type: msgtype,
Expand Down
7 changes: 4 additions & 3 deletions src/controllers/payment.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Message, Chat, models } from '../models'
import { Message, ChatRecord, models } from '../models'
import { sendNotification } from '../hub'
import * as socket from '../utils/socket'
import * as jsonUtils from '../utils/json'
Expand All @@ -14,6 +14,7 @@ import { anonymousKeysend } from './feed'
import { sphinxLogger } from '../utils/logger'
import { Req, Res } from '../types'
import { sendConfirmation } from './confirmations'
import { ChatPlusMembers } from '../network/send'

export const sendPayment = async (req: Req, res: Res): Promise<void> => {
if (!req.owner) return failure(res, 'no owner')
Expand Down Expand Up @@ -120,11 +121,11 @@ export const sendPayment = async (req: Req, res: Res): Promise<void> => {
// if remote text map, put that in
let theChat = chat
if (contact_ids) {
theChat = { ...chat.dataValues, contactIds: contact_ids } as Chat
theChat = <ChatRecord>{ ...chat.dataValues, contactIds: contact_ids }
if (remote_text_map) msgToSend.content = remote_text_map
}
network.sendMessage({
chat: theChat,
chat: theChat as Partial<ChatPlusMembers>,
sender: owner,
type: constants.message_types.direct_payment,
message: msgToSend as Message,
Expand Down
Loading