Skip to content

Commit 697ccdd

Browse files
committed
fix lint
1 parent 7b30f9d commit 697ccdd

File tree

6 files changed

+54
-31
lines changed

6 files changed

+54
-31
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/amazonq/test/unit/codewhisperer/region/regionProfileManager.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,4 +336,4 @@ describe('RegionProfileManager', async function () {
336336
assert.deepStrictEqual(client.endpoint.href, 'https://amazon.com/')
337337
})
338338
})
339-
})
339+
})

packages/amazonq/test/unit/codewhisperer/util/authUtil.test.ts

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,14 @@ describe('AuthUtil', async function () {
103103

104104
it('returns IDC forms when using IDC without SSO account access', async function () {
105105
const session = (auth as any).session
106-
session && sinon.stub(session, 'getProfile').resolves({
107-
ssoSession: {
108-
settings: {
109-
sso_registration_scopes: ['codewhisperer:*'],
106+
session &&
107+
sinon.stub(session, 'getProfile').resolves({
108+
ssoSession: {
109+
settings: {
110+
sso_registration_scopes: ['codewhisperer:*'],
111+
},
110112
},
111-
},
112-
})
113+
})
113114

114115
await auth.login_sso('https://example.awsapps.com/start', 'us-east-1')
115116
const forms = await auth.getAuthFormIds()
@@ -120,13 +121,14 @@ describe('AuthUtil', async function () {
120121
await auth.login_sso('https://example.awsapps.com/start', 'us-east-1')
121122
const session = (auth as any).session
122123

123-
session && sinon.stub(session, 'getProfile').resolves({
124-
ssoSession: {
125-
settings: {
126-
sso_registration_scopes: ['codewhisperer:*', 'sso:account:access'],
124+
session &&
125+
sinon.stub(session, 'getProfile').resolves({
126+
ssoSession: {
127+
settings: {
128+
sso_registration_scopes: ['codewhisperer:*', 'sso:account:access'],
129+
},
127130
},
128-
},
129-
})
131+
})
130132

131133
const forms = await auth.getAuthFormIds()
132134
assert.deepStrictEqual(forms.sort(), ['identityCenterCodeWhisperer', 'identityCenterExplorer'].sort())
@@ -198,7 +200,7 @@ describe('AuthUtil', async function () {
198200
it('deletes bearer token when disconnected', async function () {
199201
await (auth as any).stateChangeHandler({ state: 'notConnected' })
200202

201-
if (auth.isSsoSession(auth.session)){
203+
if (auth.isSsoSession(auth.session)) {
202204
assert.ok(mockLspAuth.deleteBearerToken.called)
203205
}
204206
})
@@ -290,14 +292,14 @@ describe('AuthUtil', async function () {
290292
memento.get.returns({ profile1: validProfile })
291293
mockLspAuth.getSsoToken.rejects(new Error('Token check failed'))
292294

293-
if (!(auth as any).session){
295+
if (!(auth as any).session) {
294296
auth.session = new auth2.SsoLogin(auth.profileName, auth.lspAuth, auth.eventEmitter)
295297
}
296-
const updateProfileStub_3 = sinon.stub((auth as any).session, 'updateProfile').resolves()
298+
const updateProfileStubNext = sinon.stub((auth as any).session, 'updateProfile').resolves()
297299

298300
await auth.migrateSsoConnectionToLsp('test-client')
299301

300-
assert.ok(updateProfileStub_3.calledOnce)
302+
assert.ok(updateProfileStubNext.calledOnce)
301303
assert.ok(memento.update.calledWith('auth.profiles', undefined))
302304
})
303305

@@ -360,17 +362,17 @@ describe('AuthUtil', async function () {
360362
}
361363
memento.get.returns(mockProfiles)
362364

363-
if (!(auth as any).session){
365+
if (!(auth as any).session) {
364366
auth.session = new auth2.SsoLogin(auth.profileName, auth.lspAuth, auth.eventEmitter)
365367
}
366368

367-
const updateProfileStub_2 = sinon.stub((auth as any).session, 'updateProfile').resolves()
369+
const updateProfileStubMore = sinon.stub((auth as any).session, 'updateProfile').resolves()
368370

369371
await auth.migrateSsoConnectionToLsp('test-client')
370372

371-
assert.ok(updateProfileStub_2.calledOnce)
373+
assert.ok(updateProfileStubMore.calledOnce)
372374
assert.ok(memento.update.calledWith('auth.profiles', undefined))
373-
assert.deepStrictEqual(updateProfileStub_2.firstCall.args[0], {
375+
assert.deepStrictEqual(updateProfileStubMore.firstCall.args[0], {
374376
startUrl: validProfile.startUrl,
375377
region: validProfile.ssoRegion,
376378
scopes: validProfile.scopes,
@@ -389,7 +391,7 @@ describe('AuthUtil', async function () {
389391
}
390392
memento.get.returns(mockProfiles)
391393

392-
if (!(auth as any).session){
394+
if (!(auth as any).session) {
393395
auth.session = new auth2.SsoLogin(auth.profileName, auth.lspAuth, auth.eventEmitter)
394396
}
395397

@@ -406,4 +408,4 @@ describe('AuthUtil', async function () {
406408
)
407409
})
408410
})
409-
})
411+
})

packages/core/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -442,9 +442,9 @@
442442
"devDependencies": {
443443
"@aws-sdk/types": "^3.13.1",
444444
"@aws/chat-client": "^0.1.4",
445-
"@aws/chat-client-ui-types": "^0.1.24",
446-
"@aws/language-server-runtimes": "^0.2.81",
447-
"@aws/language-server-runtimes-types": "^0.1.28",
445+
"@aws/chat-client-ui-types": "^0.1.53",
446+
"@aws/language-server-runtimes": "^0.2.111",
447+
"@aws/language-server-runtimes-types": "^0.1.47",
448448
"@cspotcode/source-map-support": "^0.8.1",
449449
"@sinonjs/fake-timers": "^10.0.2",
450450
"@types/adm-zip": "^0.4.34",

packages/core/src/auth/auth2.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,14 @@ export class LanguageClientAuth {
168168
} satisfies UpdateProfileParams)
169169
}
170170

171-
updateIamProfile(profileName: string, accessKey: string, secretKey: string, sessionToken?: string, roleArn?: string, sourceProfile?: string): Promise<UpdateProfileResult> {
171+
updateIamProfile(
172+
profileName: string,
173+
accessKey: string,
174+
secretKey: string,
175+
sessionToken?: string,
176+
roleArn?: string,
177+
sourceProfile?: string
178+
): Promise<UpdateProfileResult> {
172179
// Add credentials and delete SSO settings from profile
173180
let profile: Profile
174181
if (roleArn) {

packages/core/src/codewhisperer/util/authUtil.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,15 @@ import { showAmazonQWalkthroughOnce } from '../../amazonq/onboardingPage/walkthr
3030
import { setContext } from '../../shared/vscode/setContext'
3131
import { openUrl } from '../../shared/utilities/vsCodeUtils'
3232
import { telemetry } from '../../shared/telemetry/telemetry'
33-
import { AuthStateEvent, cacheChangedEvent, LanguageClientAuth, Login, SsoLogin, IamLogin, LoginTypes } from '../../auth/auth2'
33+
import {
34+
AuthStateEvent,
35+
cacheChangedEvent,
36+
LanguageClientAuth,
37+
Login,
38+
SsoLogin,
39+
IamLogin,
40+
LoginTypes,
41+
} from '../../auth/auth2'
3442
import { builderIdStartUrl, internalStartUrl } from '../../auth/sso/constants'
3543
import { VSCODE_EXTENSION_ID } from '../../shared/extensions'
3644
import { RegionProfileManager } from '../region/regionProfileManager'
@@ -167,18 +175,24 @@ export class AuthUtil implements IAuthProvider {
167175
if (!this.isSsoSession()) {
168176
this.session = new SsoLogin(this.profileName, this.lspAuth, this.eventEmitter)
169177
}
178+
// eslint-disable-next-line prefer-const
170179
response = await (this.session as SsoLogin).login({ startUrl: startUrl, region: region, scopes: amazonQScopes })
171180
await showAmazonQWalkthroughOnce()
172181
return response
173182
}
174183

175184
// Log in using IAM or STS credentials
176-
async login_iam(accessKey: string, secretKey: string, sessionToken?: string): Promise<GetIamCredentialResult | undefined> {
185+
async login_iam(
186+
accessKey: string,
187+
secretKey: string,
188+
sessionToken?: string
189+
): Promise<GetIamCredentialResult | undefined> {
177190
let response: GetIamCredentialResult | undefined
178191
// Create IAM login session
179192
if (!this.isIamSession()) {
180193
this.session = new IamLogin(this.profileName, this.lspAuth, this.eventEmitter)
181194
}
195+
// eslint-disable-next-line prefer-const
182196
response = await (this.session as IamLogin).login({ accessKey: accessKey, secretKey: secretKey })
183197
await showAmazonQWalkthroughOnce()
184198
return response
@@ -549,4 +563,4 @@ export class AuthUtil implements IAuthProvider {
549563
await memento.update(key, undefined)
550564
}
551565
}
552-
}
566+
}

0 commit comments

Comments
 (0)