Fix lexical scope

This commit is contained in:
AkiraFukushima 2020-05-17 16:31:37 +09:00
parent 27dc4ed5cd
commit aec8f67b81
10 changed files with 23 additions and 18 deletions

9
package-lock.json generated
View File

@ -8680,7 +8680,7 @@
"dependencies": {
"resolve": {
"version": "1.1.7",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz",
"resolved": "http://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz",
"integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=",
"dev": true
}
@ -27663,6 +27663,7 @@
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.4.9.tgz",
"integrity": "sha512-8CJsbKOtEbnJsTyv6LE6m6ZKniqMiFWmm9sRbopbkGs3gMPPfd3Fh8iIA4Ykv5MgaTbqHr4BaoGLJLZNhsrW1Q==",
"dev": true,
"optional": true,
"requires": {
"commander": "~2.17.1",
"source-map": "~0.6.1"
@ -27672,13 +27673,15 @@
"version": "2.17.1",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.17.1.tgz",
"integrity": "sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==",
"dev": true
"dev": true,
"optional": true
},
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true
"dev": true,
"optional": true
}
}
},

View File

@ -57,7 +57,7 @@ const account: Entity.Account = {
bot: false
}
let state = (): EditState => {
const state = (): EditState => {
return {
members: []
}

View File

@ -39,7 +39,7 @@ const list: Entity.List = {
title: 'list1'
}
let state = (): IndexState => {
const state = (): IndexState => {
return {
lists: []
}

View File

@ -45,7 +45,7 @@ jest.mock('megalodon', () => ({
__esModule: true
}))
let state = (): AccountState => {
const state = (): AccountState => {
return {
results: []
}

View File

@ -33,7 +33,7 @@ jest.mock('megalodon', () => ({
__esModule: true
}))
let state = (): TagState => {
const state = (): TagState => {
return {
results: []
}

View File

@ -83,7 +83,7 @@ const status: Entity.Status = {
quote: false
}
let state = (): TootsState => {
const state = (): TootsState => {
return {
results: []
}

View File

@ -119,7 +119,7 @@ const userData = app.getPath('userData')
const appPath = app.getPath('exe')
const accountDBPath = process.env.NODE_ENV === 'production' ? userData + '/db/account.db' : 'account.db'
let accountDB = new Datastore({
const accountDB = new Datastore({
filename: accountDBPath,
autoload: true
})
@ -127,7 +127,7 @@ const accountManager = new Account(accountDB)
accountManager.initialize().catch((err: Error) => log.error(err))
const hashtagsDBPath = process.env.NODE_ENV === 'production' ? userData + '/db/hashtags.db' : 'hashtags.db'
let hashtagsDB = new Datastore({
const hashtagsDB = new Datastore({
filename: hashtagsDBPath,
autoload: true
})
@ -250,7 +250,7 @@ async function createWindow() {
/**
* Initial window options
*/
let mainWindowState = windowStateKeeper({
const mainWindowState = windowStateKeeper({
defaultWidth: 1000,
defaultHeight: 563
})
@ -365,7 +365,7 @@ app.on('activate', () => {
}
})
let auth = new Authentication(accountManager)
const auth = new Authentication(accountManager)
type AuthRequest = {
instance: string
@ -553,7 +553,7 @@ ipcMain.handle(
)
// user streaming
let userStreamings: { [key: string]: UserStreaming | null } = {}
const userStreamings: { [key: string]: UserStreaming | null } = {}
ipcMain.on('start-all-user-streamings', (event: IpcMainEvent, accounts: Array<LocalAccount>) => {
accounts.map(async account => {

View File

@ -185,10 +185,11 @@ export default {
case 'edit':
window.shell.openExternal(this.account.baseURL + '/settings/profile')
break
case 'settings':
case 'settings': {
const url = `/${this.id()}/settings`
this.$router.push(url)
break
}
}
},
doCollapse() {

View File

@ -331,7 +331,7 @@ export default {
return this.$store.state.TimelineSpace.account.accountId === this.originalMessage.account.id
},
application: function () {
let msg = this.originalMessage
const msg = this.originalMessage
if (msg.application !== undefined && msg.application !== null) {
return msg.application.name
}
@ -615,13 +615,14 @@ export default {
case 'profile':
this.openUser(this.originalMessage.account)
break
case 'image':
case 'image': {
const images = this.mediaAttachments
if (images.length === 0) {
return 0
}
this.openImage(images[0].url, images)
break
}
case 'cw':
this.showContent = !this.showContent
this.showAttachments = !this.showAttachments

View File

@ -2,8 +2,8 @@
const textAtCursorMatch = (str, cursorPosition, separators = ['@', '#', ':']) => {
let word
let left = str.slice(0, cursorPosition).search(/\S+$/)
let right = str.slice(cursorPosition).search(/\s/)
const left = str.slice(0, cursorPosition).search(/\S+$/)
const right = str.slice(cursorPosition).search(/\s/)
if (right < 0) {
word = str.slice(left)