Skip to content

Commit 44df9d9

Browse files
committed
Applying linter to packages/core/src
1 parent 70eb49d commit 44df9d9

31 files changed

+869
-846
lines changed

packages/core/src/auth.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
*/
3030
const auth = {
3131
basic: (username: string, password: string, realm?: string) => {
32-
if (realm) {
32+
if (realm != null) {
3333
return {
3434
scheme: 'basic',
3535
principal: username,
@@ -77,12 +77,12 @@ const auth = {
7777
}
7878
}
7979

80-
function isNotEmpty<T extends object | string>(value: T | null | undefined): boolean {
80+
function isNotEmpty<T extends object | string> (value: T | null | undefined): boolean {
8181
return !(
8282
value === null ||
8383
value === undefined ||
8484
value === '' ||
85-
Object.getPrototypeOf(value) === Object.prototype && Object.keys(value).length === 0
85+
(Object.getPrototypeOf(value) === Object.prototype && Object.keys(value).length === 0)
8686
)
8787
}
8888

packages/core/src/connection-provider.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import Connection from './connection'
2121
import { bookmarks } from './internal'
2222
import { ServerInfo } from './result-summary'
2323

24-
2524
/**
2625
* Inteface define a common way to acquire a connection
2726
*
@@ -44,11 +43,11 @@ class ConnectionProvider {
4443
* @property {string} param.impersonatedUser - the impersonated user
4544
* @property {function (databaseName:string?)} param.onDatabaseNameResolved - Callback called when the database name get resolved
4645
*/
47-
acquireConnection(param?: {
46+
async acquireConnection (param?: {
4847
accessMode?: string
4948
database?: string
50-
bookmarks: bookmarks.Bookmarks,
51-
impersonatedUser?: string,
49+
bookmarks: bookmarks.Bookmarks
50+
impersonatedUser?: string
5251
onDatabaseNameResolved?: (databaseName?: string) => void
5352
}): Promise<Connection> {
5453
throw Error('Not implemented')
@@ -60,7 +59,7 @@ class ConnectionProvider {
6059
*
6160
* @returns {Promise<boolean>}
6261
*/
63-
supportsMultiDb(): Promise<boolean> {
62+
async supportsMultiDb (): Promise<boolean> {
6463
throw Error('Not implemented')
6564
}
6665

@@ -70,7 +69,7 @@ class ConnectionProvider {
7069
*
7170
* @returns {Promise<boolean>}
7271
*/
73-
supportsTransactionConfig(): Promise<boolean> {
72+
async supportsTransactionConfig (): Promise<boolean> {
7473
throw Error('Not implemented')
7574
}
7675

@@ -80,7 +79,7 @@ class ConnectionProvider {
8079
*
8180
* @returns {Promise<boolean>}
8281
*/
83-
supportsUserImpersonation(): Promise<boolean> {
82+
async supportsUserImpersonation (): Promise<boolean> {
8483
throw Error('Not implemented')
8584
}
8685

@@ -94,7 +93,7 @@ class ConnectionProvider {
9493
*
9594
* @returns {Promise<ServerInfo>} promise resolved with server info or rejected with error.
9695
*/
97-
verifyConnectivityAndGetServerInfo(param? :{ database?: string, accessMode?: string }): Promise<ServerInfo> {
96+
async verifyConnectivityAndGetServerInfo (param?: { database?: string, accessMode?: string }): Promise<ServerInfo> {
9897
throw Error('Not implemented')
9998
}
10099

@@ -103,7 +102,7 @@ class ConnectionProvider {
103102
*
104103
* @returns {Promise<void>}
105104
*/
106-
close(): Promise<void> {
105+
async close (): Promise<void> {
107106
throw Error('Not implemented')
108107
}
109108
}

packages/core/src/connection.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,28 @@ import { ServerAddress } from './internal/server-address'
2525
*/
2626
class Connection {
2727
get id (): string {
28-
return ""
28+
return ''
2929
}
3030

31-
get databaseId(): string {
32-
return ""
31+
get databaseId (): string {
32+
return ''
3333
}
3434

35-
get server(): any {
35+
get server (): any {
3636
return {}
3737
}
3838

3939
/**
4040
* @property {ServerAddress} the server address this connection is opened against
4141
*/
42-
get address(): ServerAddress | undefined {
42+
get address (): ServerAddress | undefined {
4343
return undefined
4444
}
4545

4646
/**
4747
* @property {ServerVersion} the version of the server this connection is connected to
4848
*/
49-
get version(): any {
49+
get version (): any {
5050
return undefined
5151
}
5252

@@ -71,7 +71,7 @@ class Connection {
7171
* @param {Object} authToken the object containing auth information.
7272
* @return {Promise<Connection>} promise resolved with the current connection if connection is successful. Rejected promise otherwise.
7373
*/
74-
connect (userAgent: string, authToken: any): Promise<Connection> {
74+
async connect (userAgent: string, authToken: any): Promise<Connection> {
7575
throw Error('Not implemented')
7676
}
7777

@@ -89,7 +89,7 @@ class Connection {
8989
* Send a RESET-message to the database. Message is immediately flushed to the network.
9090
* @return {Promise<void>} promise resolved when SUCCESS-message response arrives, or failed when other response messages arrives.
9191
*/
92-
resetAndFlush (): Promise<void> {
92+
async resetAndFlush (): Promise<void> {
9393
throw Error('Not implemented')
9494
}
9595

@@ -98,15 +98,15 @@ class Connection {
9898
* @returns {Promise<void>} - A promise that will be resolved when the connection is closed.
9999
*
100100
*/
101-
close (): Promise<void> {
101+
async close (): Promise<void> {
102102
throw Error('Not implemented')
103103
}
104104

105105
/**
106106
* Called to release the connection
107107
*/
108-
_release (): Promise<void> {
109-
return Promise.resolve()
108+
async _release (): Promise<void> {
109+
return await Promise.resolve()
110110
}
111111
}
112112

0 commit comments

Comments
 (0)