Skip to content

Commit 48c03f5

Browse files
committed
fix lint errors
1 parent 44db84f commit 48c03f5

File tree

3 files changed

+24
-23
lines changed

3 files changed

+24
-23
lines changed

packages/cubejs-mssql-driver/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
"build": "rm -rf dist && npm run tsc",
2222
"tsc": "tsc",
2323
"watch": "tsc -w",
24-
"lint": "eslint src/* test/* --ext .ts,.js",
25-
"lint:fix": "eslint --fix src/* test/* --ext .ts,.js"
24+
"lint": "eslint src/* --ext .ts,.js",
25+
"lint:fix": "eslint --fix src/* --ext .ts,.js"
2626
},
2727
"dependencies": {
2828
"@cubejs-backend/base-driver": "1.3.5",

packages/cubejs-mssql-driver/src/MSSqlDriver.ts

+12-12
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ const numericTypes = [
3535
];
3636

3737
for (const type of numericTypes) {
38-
sql.valueHandler.set(type, (value) => value != null ? String(value) : value);
38+
sql.valueHandler.set(type, (value) => (value != null ? String(value) : value));
3939
}
4040

4141
export type MSSqlDriverConfiguration = Omit<MsSQLConfig, 'server'> & {
4242
readOnly?: boolean;
4343
server?: string;
44-
}
44+
};
4545

4646
const GenericTypeToMSSql: Record<string, string> = {
4747
boolean: 'bit',
@@ -55,28 +55,29 @@ const MSSqlToGenericType: Record<string, string> = {
5555
bit: 'boolean',
5656
uniqueidentifier: 'uuid',
5757
datetime2: 'timestamp'
58-
}
58+
};
5959

6060
/**
6161
* MS SQL driver class.
6262
*/
6363
export class MSSqlDriver extends BaseDriver implements DriverInterface {
64-
6564
private readonly connectionPool: ConnectionPool;
65+
6666
private readonly initialConnectPromise: Promise<ConnectionPool>;
67+
6768
private readonly config: MSSqlDriverConfiguration;
6869

6970
/**
7071
* Returns default concurrency value.
7172
*/
72-
static getDefaultConcurrency() {
73+
public static getDefaultConcurrency() {
7374
return 2;
7475
}
7576

7677
/**
7778
* Class constructor.
7879
*/
79-
constructor(config: MSSqlDriverConfiguration & {
80+
public constructor(config: MSSqlDriverConfiguration & {
8081
/**
8182
* Data source name.
8283
*/
@@ -93,8 +94,7 @@ export class MSSqlDriver extends BaseDriver implements DriverInterface {
9394
*/
9495
testConnectionTimeout?: number,
9596
server?: string,
96-
} = {}
97-
) {
97+
} = {}) {
9898
super({
9999
testConnectionTimeout: config.testConnectionTimeout,
100100
});
@@ -140,7 +140,7 @@ export class MSSqlDriver extends BaseDriver implements DriverInterface {
140140
* Note: It returns the unprefixed option names.
141141
* In case of using multi sources options need to be prefixed manually.
142142
*/
143-
static driverEnvVariables() {
143+
public static driverEnvVariables() {
144144
return [
145145
'CUBEJS_DB_HOST',
146146
'CUBEJS_DB_NAME',
@@ -184,7 +184,7 @@ export class MSSqlDriver extends BaseDriver implements DriverInterface {
184184
});
185185
stream.on('error', (err: Error) => {
186186
reject(err);
187-
})
187+
});
188188
});
189189
return {
190190
rowStream: stream,
@@ -211,7 +211,7 @@ export class MSSqlDriver extends BaseDriver implements DriverInterface {
211211
* }
212212
* }} fields
213213
*/
214-
mapFields(fields: Record<string, any>) {
214+
private mapFields(fields: Record<string, any>) {
215215
return Object.keys(fields).map((field) => {
216216
let type;
217217
switch (fields[field].type) {
@@ -368,7 +368,7 @@ export class MSSqlDriver extends BaseDriver implements DriverInterface {
368368
return GenericTypeToMSSql[columnType] || super.fromGenericType(columnType);
369369
}
370370

371-
protected toGenericType(columnType: string): string{
371+
protected toGenericType(columnType: string): string {
372372
return MSSqlToGenericType[columnType] || super.toGenericType(columnType);
373373
}
374374

packages/cubejs-mssql-driver/src/QueryStream.ts

+10-9
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@ import {
99
*/
1010
export class QueryStream extends Readable {
1111
private request: sql.Request | null;
12+
1213
private toRead: number = 0;
1314

1415
/**
1516
* @constructor
1617
*/
17-
constructor(request: sql.Request, highWaterMark: number) {
18+
public constructor(request: sql.Request, highWaterMark: number) {
1819
super({
1920
objectMode: true,
2021
highWaterMark:
@@ -27,10 +28,10 @@ export class QueryStream extends Readable {
2728
if (this.toRead-- <= 0 || !canAdd) {
2829
this.request?.pause();
2930
}
30-
})
31+
});
3132
this.request.on('done', () => {
3233
this.push(null);
33-
})
34+
});
3435
this.request.on('error', (err: Error) => {
3536
this.destroy(err);
3637
});
@@ -39,23 +40,23 @@ export class QueryStream extends Readable {
3940
/**
4041
* @override
4142
*/
42-
_read(toRead: number) {
43+
public _read(toRead: number) {
4344
this.toRead += toRead;
4445
this.request?.resume();
4546
}
4647

47-
transformRow(row: Record<string, any>) {
48-
for (const key in row) {
49-
if (row.hasOwnProperty(key) && row[key] && row[key] instanceof Date) {
50-
row[key] = row[key].toJSON();
48+
private transformRow(row: Record<string, any>) {
49+
for (const [key, value] of Object.entries(row)) {
50+
if (value instanceof Date) {
51+
row[key] = value.toJSON();
5152
}
5253
}
5354
}
5455

5556
/**
5657
* @override
5758
*/
58-
_destroy(error: any, callback: CallableFunction) {
59+
public _destroy(error: any, callback: CallableFunction) {
5960
this.request?.cancel();
6061
this.request = null;
6162
callback(error);

0 commit comments

Comments
 (0)