Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
"devDependencies": {
"@commitlint/cli": "^8.3.5",
"@commitlint/config-conventional": "^8.3.4",
"@sourcegraph/eslint-config": "^0.17.2",
"@sourcegraph/eslint-config": "^0.19.2",
"@sourcegraph/prettierrc": "^3.0.3",
"@sourcegraph/tsconfig": "^3.0.0",
"@types/mocha": "7.0.2",
Expand Down
4 changes: 2 additions & 2 deletions src/codeownersFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ export interface CodeOwnersEntry {
* Parse a CODEOWNERS file into an array of entries (will be in reverse order
* of the file).
*/
export function parseCodeownersFile(str: string): CodeOwnersEntry[] {
export function parseCodeownersFile(string: string): CodeOwnersEntry[] {
const entries: CodeOwnersEntry[] = []
const lines = str.split('\n')
const lines = string.split('\n')

for (const [index, lineText] of lines.entries()) {
const [content] = lineText.split('#')
Expand Down
8 changes: 4 additions & 4 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { getCodeOwners } from './codeownersFile'
import { formatCodeOwners } from './codeOwners'
import { resolveURI } from './uri'

export function activate(ctx: sourcegraph.ExtensionContext): void {
ctx.subscriptions.add(
export function activate(context: sourcegraph.ExtensionContext): void {
context.subscriptions.add(
combineLatest([
from(sourcegraph.workspace.onDidOpenTextDocument).pipe(
startWith(
Expand All @@ -24,8 +24,8 @@ export function activate(ctx: sourcegraph.ExtensionContext): void {
if (!sourcegraph.configuration.get().value['codeOwnership.hide']) {
try {
return { textDocument, resolvedOwnersLine: await getCodeOwners(textDocument.uri) }
} catch (err) {
console.error(`Error getting code owners for ${textDocument.uri}:`, err)
} catch (error) {
console.error(`Error getting code owners for ${textDocument.uri}:`, error)
}
}
return { textDocument, resolvedOwnersLine: null }
Expand Down
12 changes: 6 additions & 6 deletions src/util/memoizeAsync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ export function memoizeAsync<P, T>(
toKey: (params: P) => string
): (params: P) => Promise<T> {
const cache = new Map<string, Promise<T>>()
return (params: P) => {
const key = toKey(params)
return (parameters: P) => {
const key = toKey(parameters)
const hit = cache.get(key)
if (hit) {
return hit
}
const p = func(params)
p.then(null, () => cache.delete(key))
cache.set(key, p)
return p
const promise = func(parameters)
promise.then(null, () => cache.delete(key))
cache.set(key, promise)
return promise
}
}
Loading