Skip to content

Commit 5d621c8

Browse files
authored
lint #3700
prettier was not run on some files
1 parent c94acfd commit 5d621c8

File tree

11 files changed

+99
-85
lines changed

11 files changed

+99
-85
lines changed

src/cloudWatchLogs/commands/copyLogResource.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@ import { copyToClipboard } from '../../shared/utilities/messages'
1212

1313
export async function copyLogResource(uri?: vscode.Uri): Promise<void> {
1414
try {
15-
1615
if (!uri) {
1716
// No URI = used command palette as entrypoint, attempt to get URI from active editor
1817
// should work correctly under any normal circumstances since the action only appears in command palette when the editor is a CloudWatch Logs editor
1918
uri = vscode.window.activeTextEditor?.document.uri
2019
if (!uri) {
21-
throw new Error("no active text editor, or undefined URI")
20+
throw new Error('no active text editor, or undefined URI')
2221
}
23-
}
22+
}
2423
const parsedUri = parseCloudWatchLogsUri(uri)
2524
const resourceName = isLogStreamUri(uri) ? parsedUri.logGroupInfo.streamName : parsedUri.logGroupInfo.groupName
2625

src/cloudWatchLogs/timeFilterSubmenu.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ export class TimeFilterSubmenu extends Prompter<TimeFilterResponse> {
4444
data: 0,
4545
})
4646
options.push({
47-
label: 'Last 15 minutes',
47+
label: 'Last 15 minutes',
4848
data: 15,
4949
})
5050
options.push({
51-
label: 'Last hour',
51+
label: 'Last hour',
5252
data: 60,
5353
})
5454
options.push({
55-
label: 'Last 3 Hours',
55+
label: 'Last 3 Hours',
5656
data: 60 * 3,
5757
})
5858
options.push({
@@ -68,15 +68,15 @@ export class TimeFilterSubmenu extends Prompter<TimeFilterResponse> {
6868
data: 60 * 24 * 7,
6969
})
7070
options.push({
71-
label: 'Last month',
72-
data: 60 * 24 * 31,
71+
label: 'Last month',
72+
data: 60 * 24 * 31,
7373
})
7474
options.push({
75-
label: 'Last 3 months',
75+
label: 'Last 3 months',
7676
data: 60 * 24 * 31 * 3,
7777
})
7878
options.push({
79-
label: 'Last year',
79+
label: 'Last year',
8080
data: 60 * 24 * 365,
8181
})
8282
return options

src/codecatalyst/wizards/devenvSettings.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import { Prompter } from '../../shared/ui/prompter'
1010
import { toTitleCase } from '../../shared/utilities/textUtilities'
1111

1212
const devenvOptions = settings['environment']
13-
export type InstanceType = keyof typeof devenvOptions['instanceType']
14-
export type SubscriptionType = typeof subscriptionTypes[number]
13+
export type InstanceType = keyof (typeof devenvOptions)['instanceType']
14+
export type SubscriptionType = (typeof subscriptionTypes)[number]
1515

1616
const subscriptionTypes = ['FREE', 'STANDARD'] as const
1717

src/shared/clients/devenvClient.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,11 @@ export class DevEnvClient implements vscode.Disposable {
124124

125125
/**
126126
* This allows you to easily work with Dev Env user activity timestamps.
127-
*
127+
*
128128
* An activity is a timestamp that the server uses to
129129
* determine when the user was last active.
130130
*/
131-
export class DevEnvActivity implements vscode.Disposable{
131+
export class DevEnvActivity implements vscode.Disposable {
132132
private activityUpdatedEmitter = new vscode.EventEmitter<number>()
133133
private ideActivityListener: vscode.Disposable | undefined
134134
/** The last known activity timestamp, but there could be a newer one on the server. */
@@ -140,21 +140,24 @@ export class DevEnvActivity implements vscode.Disposable{
140140
/**
141141
* Returns an instance if the activity mechanism is confirmed to be working.
142142
*/
143-
static async instanceIfActivityTrackingEnabled(client: DevEnvClient, extensionUserActivity?: ExtensionUserActivity): Promise<DevEnvActivity | undefined> {
143+
static async instanceIfActivityTrackingEnabled(
144+
client: DevEnvClient,
145+
extensionUserActivity?: ExtensionUserActivity
146+
): Promise<DevEnvActivity | undefined> {
144147
try {
145148
await client.getActivity()
146-
}
147-
catch (e) {
149+
} catch (e) {
148150
const error = e instanceof HTTPError ? e.response.body : e
149151
getLogger().error(`DevEnvActivity: Activity API failed:%s`, error)
150152
return undefined
151153
}
152-
154+
153155
return new DevEnvActivity(client, extensionUserActivity)
154156
}
155157

156158
private constructor(private readonly client: DevEnvClient, extensionUserActivity?: ExtensionUserActivity) {
157-
this.extensionUserActivity = extensionUserActivity ?? new ExtensionUserActivity(DevEnvActivity.activityUpdateDelay)
159+
this.extensionUserActivity =
160+
extensionUserActivity ?? new ExtensionUserActivity(DevEnvActivity.activityUpdateDelay)
158161
}
159162

160163
/** Send activity timestamp to the Dev Env */
@@ -168,7 +171,7 @@ export class DevEnvActivity implements vscode.Disposable{
168171
/** Get the latest activity timestamp from the Dev Env */
169172
async getLatestActivity(): Promise<number | undefined> {
170173
const lastServerActivity = await this.client.getActivity()
171-
174+
172175
// A single Dev Env can have multiple clients connected to it.
173176
// So if one client updates the timestamp, it will be different from what the
174177
// other clients assumed the last activity was.
@@ -182,7 +185,7 @@ export class DevEnvActivity implements vscode.Disposable{
182185

183186
/** true, if the latest activity on the server is different from what this client has as the latest */
184187
async isLocalActivityStale(): Promise<boolean> {
185-
return await this.getLatestActivity() !== this.lastLocalActivity
188+
return (await this.getLatestActivity()) !== this.lastLocalActivity
186189
}
187190

188191
/** Runs the given callback when the activity is updated */

src/shared/extensionUtilities.ts

Lines changed: 54 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -393,13 +393,14 @@ export class ExtensionUserActivity implements vscode.Disposable {
393393

394394
if (customEvents) {
395395
customEvents.forEach(event =>
396-
this.register(event(() => {
397-
throttledEmit(event)
398-
}))
396+
this.register(
397+
event(() => {
398+
throttledEmit(event)
399+
})
400+
)
399401
)
400-
}
401-
else {
402-
this.registerAllEvents(throttledEmit)
402+
} else {
403+
this.registerAllEvents(throttledEmit)
403404
}
404405

405406
this.disposables.push(this.activityEvent)
@@ -410,48 +411,58 @@ export class ExtensionUserActivity implements vscode.Disposable {
410411
*/
411412
private registerAllEvents(throttledEmit: (e: vscode.Event<any>) => any) {
412413
this.activityEvents.forEach(event =>
413-
this.register(event(() => {
414-
throttledEmit(event)
415-
}))
414+
this.register(
415+
event(() => {
416+
throttledEmit(event)
417+
})
418+
)
416419
)
417420

418421
/** ---- Events with edge cases ---- */
419-
this.register(vscode.window.onDidChangeWindowState(e => {
420-
if ((e as any).active === false) {
421-
return
422-
}
423-
throttledEmit(vscode.window.onDidChangeWindowState)
424-
}))
425-
426-
this.register(vscode.workspace.onDidChangeTextDocument(e => {
427-
// Our extension may change a file in the background (eg: log file)
428-
const uriOfDocumentUserIsEditing = vscode.window.activeTextEditor?.document?.uri
429-
if (!uriOfDocumentUserIsEditing) {
430-
// User was not editing any file themselves
431-
return
432-
}
433-
if (uriOfDocumentUserIsEditing !== e.document.uri) {
434-
// File changed was not the one the user was actively working on
435-
return
436-
}
437-
throttledEmit(vscode.workspace.onDidChangeTextDocument)
438-
}))
422+
this.register(
423+
vscode.window.onDidChangeWindowState(e => {
424+
if ((e as any).active === false) {
425+
return
426+
}
427+
throttledEmit(vscode.window.onDidChangeWindowState)
428+
})
429+
)
439430

440-
this.register(vscode.window.onDidChangeTextEditorSelection(e => {
441-
if(e.textEditor.document.uri.scheme === 'output') {
442-
// Ignore `output` scheme as text editors from output panel autoscroll
443-
return
444-
}
445-
throttledEmit(vscode.window.onDidChangeTextEditorSelection)
446-
}))
431+
this.register(
432+
vscode.workspace.onDidChangeTextDocument(e => {
433+
// Our extension may change a file in the background (eg: log file)
434+
const uriOfDocumentUserIsEditing = vscode.window.activeTextEditor?.document?.uri
435+
if (!uriOfDocumentUserIsEditing) {
436+
// User was not editing any file themselves
437+
return
438+
}
439+
if (uriOfDocumentUserIsEditing !== e.document.uri) {
440+
// File changed was not the one the user was actively working on
441+
return
442+
}
443+
throttledEmit(vscode.workspace.onDidChangeTextDocument)
444+
})
445+
)
447446

448-
this.register(vscode.window.onDidChangeTextEditorVisibleRanges(e => {
449-
if(e.textEditor.document.uri.scheme === 'output') {
450-
// Ignore `output` scheme as text editors from output panel autoscroll
451-
return
452-
}
453-
throttledEmit(vscode.window.onDidChangeTextEditorVisibleRanges)
454-
}))
447+
this.register(
448+
vscode.window.onDidChangeTextEditorSelection(e => {
449+
if (e.textEditor.document.uri.scheme === 'output') {
450+
// Ignore `output` scheme as text editors from output panel autoscroll
451+
return
452+
}
453+
throttledEmit(vscode.window.onDidChangeTextEditorSelection)
454+
})
455+
)
456+
457+
this.register(
458+
vscode.window.onDidChangeTextEditorVisibleRanges(e => {
459+
if (e.textEditor.document.uri.scheme === 'output') {
460+
// Ignore `output` scheme as text editors from output panel autoscroll
461+
return
462+
}
463+
throttledEmit(vscode.window.onDidChangeTextEditorVisibleRanges)
464+
})
465+
)
455466
}
456467

457468
private activityEvents: vscode.Event<any>[] = [

src/shared/utilities/collectionUtils.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,4 +508,3 @@ export function createCollectionFromPages<T>(...pages: T[]): AsyncCollection<T>
508508
return pages[pages.length - 1]
509509
})
510510
}
511-

src/test/samples/javascript/sampleFunctions.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ module.exports.directExportsArrowFunction = name => {
2929
module.exports.directExportsArrowFunctionAsync = async name => {
3030
console.log(name)
3131
}
32-
module.exports.directExportsFunction = function(name) {
32+
module.exports.directExportsFunction = function (name) {
3333
console.log(name)
3434
}
35-
module.exports.directExportsFunctionAsync = async function(name) {
35+
module.exports.directExportsFunctionAsync = async function (name) {
3636
console.log(name)
3737
}
3838

src/test/shared/clients/devenvClient.test.ts

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ import { SinonStub, SinonStubbedInstance, SinonStubbedMember, createSandbox, cre
66
import * as assert from 'assert'
77
import * as vscode from 'vscode'
88

9-
import {ExtensionUserActivity} from '../../../shared/extensionUtilities'
9+
import { ExtensionUserActivity } from '../../../shared/extensionUtilities'
1010
import { DevEnvClient, DevEnvActivity } from '../../../shared/clients/devenvClient'
1111
import { sleep } from '../../../shared/utilities/timeoutUtils'
1212

13-
1413
describe('DevEnvActivity', function () {
1514
let triggerUserActivityEvent: (obj: any) => Promise<void>
1615
let userActivityEvent: SinonStub<Parameters<vscode.Event<any>>, vscode.Disposable>
@@ -19,15 +18,12 @@ describe('DevEnvActivity', function () {
1918
let devEnvActivity: DevEnvActivity
2019
let sandbox: sinon.SinonSandbox
2120

22-
before(function() {
21+
before(function () {
2322
sandbox = createSandbox()
2423
})
2524

2625
beforeEach(async function () {
27-
userActivityEvent = sandbox.stub(
28-
vscode.window,
29-
'onDidChangeActiveColorTheme'
30-
)
26+
userActivityEvent = sandbox.stub(vscode.window, 'onDidChangeActiveColorTheme')
3127
userActivityEvent.callsFake((throttledEventFire: (obj: any) => void) => {
3228
triggerUserActivityEvent = async (obj: any) => {
3329
throttledEventFire(obj)
@@ -38,13 +34,16 @@ describe('DevEnvActivity', function () {
3834
await sleep(100)
3935
}
4036
return {
41-
dispose: sandbox.stub()
37+
dispose: sandbox.stub(),
4238
}
4339
})
44-
40+
4541
devEnvClientStub = createStubInstance(DevEnvClient)
4642

47-
devEnvActivity = (await DevEnvActivity.instanceIfActivityTrackingEnabled(devEnvClientStub as unknown as DevEnvClient, new ExtensionUserActivity(0, [userActivityEvent])))!
43+
devEnvActivity = (await DevEnvActivity.instanceIfActivityTrackingEnabled(
44+
devEnvClientStub as unknown as DevEnvClient,
45+
new ExtensionUserActivity(0, [userActivityEvent])
46+
))!
4847
})
4948

5049
afterEach(function () {
@@ -57,12 +56,15 @@ describe('DevEnvActivity', function () {
5756

5857
it('does not allow instance to be created if activity API not working', async function () {
5958
devEnvClientStub.getActivity.throws()
60-
const instance = (await DevEnvActivity.instanceIfActivityTrackingEnabled(devEnvClientStub as unknown as DevEnvClient, new ExtensionUserActivity(0, [userActivityEvent])))
59+
const instance = await DevEnvActivity.instanceIfActivityTrackingEnabled(
60+
devEnvClientStub as unknown as DevEnvClient,
61+
new ExtensionUserActivity(0, [userActivityEvent])
62+
)
6163
assert.strictEqual(instance, undefined)
6264
})
6365

6466
describe('activity subscribers are properly notified', function () {
65-
beforeEach(function() {
67+
beforeEach(function () {
6668
activitySubscriber = sandbox.stub()
6769
devEnvActivity.onActivityUpdate(activitySubscriber)
6870
})
@@ -81,10 +83,10 @@ describe('DevEnvActivity', function () {
8183

8284
it('when we discover a different activity timestamp on the server', async () => {
8385
assert.strictEqual(activitySubscriber.callCount, 0)
84-
86+
8587
await devEnvActivity.sendActivityUpdate(111) // We send an activity update
8688
assert.strictEqual(activitySubscriber.callCount, 1)
87-
89+
8890
devEnvClientStub.getActivity.resolves(222) // If we retrieve the latest activity timestamp it will be different
8991
await devEnvActivity.getLatestActivity()
9092
assert.strictEqual(activitySubscriber.callCount, 2)

src/test/shared/defaultAwsClientBuilder.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ describe('DefaultAwsClientBuilder', function () {
8484
})
8585

8686
describe('request listeners', function () {
87-
type WithConfig = Parameters<typeof builder['createAwsService']>[1] & { apiConfig: Record<string, any> }
87+
type WithConfig = Parameters<(typeof builder)['createAwsService']>[1] & { apiConfig: Record<string, any> }
8888

8989
it('calls listener with correct type', async function () {
9090
const service = await builder.createAwsService(Service, {

src/test/shared/treeview/resource.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { toCollection } from '../../../shared/utilities/asyncCollection'
1111

1212
type Replace<T, K extends keyof T, U> = Omit<T, K> & { [P in K]: U }
1313
type BoundCommand<T extends any[]> = Replace<Command, 'arguments', T>
14-
type LoadMoreBoundCommand = BoundCommand<Parameters<typeof loadMoreCommand['execute']>>
14+
type LoadMoreBoundCommand = BoundCommand<Parameters<(typeof loadMoreCommand)['execute']>>
1515
type LoadMoreNode = Replace<TreeNode, 'getTreeItem', () => Replace<TreeItem, 'command', LoadMoreBoundCommand>>
1616

1717
function isLoadMoreNode(node: TreeNode): node is LoadMoreNode {

0 commit comments

Comments
 (0)