Skip to content

Commit bb21ca3

Browse files
Linting and minor package updates
1 parent 7f70e42 commit bb21ca3

File tree

6 files changed

+33
-28
lines changed

6 files changed

+33
-28
lines changed

.eslintrc.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ module.exports = {
44
plugins: ['@typescript-eslint', 'node', 'prettier'],
55
parserOptions: {
66
tsconfigRootDir: __dirname,
7-
project: ['./tsconfig.json'],
7+
project: ['./tsconfig.json']
88
},
99
extends: [
1010
'eslint:recommended',
1111
'plugin:node/recommended',
1212
'plugin:@typescript-eslint/eslint-recommended',
1313
'plugin:@typescript-eslint/recommended',
1414
'plugin:@typescript-eslint/recommended-requiring-type-checking',
15-
'plugin:prettier/recommended',
15+
'plugin:prettier/recommended'
1616
],
1717
rules: {
1818
'prettier/prettier': 'warn',
@@ -23,11 +23,12 @@ module.exports = {
2323
'node/shebang': 'off',
2424
'@typescript-eslint/no-use-before-define': 'off',
2525
quotes: ['warn', 'single', { avoidEscape: true }],
26-
'semi': ['error', 'never'],
26+
semi: ['error', 'never'],
2727
'node/no-unpublished-import': 'off',
2828
'@typescript-eslint/no-unsafe-assignment': 'off',
2929
'@typescript-eslint/no-var-requires': 'off',
3030
'@typescript-eslint/ban-ts-comment': 'off',
3131
'@typescript-eslint/no-explicit-any': 'off',
32-
},
33-
};
32+
'@typescript-eslint/no-unsafe-member-access': 'off'
33+
}
34+
}

package-lock.json

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@
4848
},
4949
"devDependencies": {
5050
"@types/jest": "^29.5.11",
51-
"@types/lz4": "^0.6.3",
51+
"@types/lz4": "^0.6.4",
5252
"@types/node": "^12.20.55",
5353
"@typescript-eslint/eslint-plugin": "^4.22.0",
5454
"@typescript-eslint/parser": "^4.22.0",
55-
"dotenv": "^16.3.1",
56-
"eslint": "^7.25.0",
57-
"eslint-config-prettier": "^8.3.0",
55+
"dotenv": "^16.4.1",
56+
"eslint": "^7.32.0",
57+
"eslint-config-prettier": "^8.10.0",
5858
"eslint-plugin-node": "^11.1.0",
59-
"eslint-plugin-prettier": "^3.4.0",
59+
"eslint-plugin-prettier": "^3.4.1",
6060
"jest": "^29.7.0",
6161
"prettier": "^2.2.1",
6262
"sqlite3": "^5.1.6",

src/connection.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44

55
import { SQLiteCloudConfig, SQLiteCloudError, ErrorCallback, ResultsCallback } from './types'
6-
import { parseConnectionString, parseBoolean, isBrowser, isNode } from './utilities'
6+
import { parseConnectionString, parseBoolean, isBrowser } from './utilities'
77

88
/** Default timeout value for queries */
99
export const DEFAULT_TIMEOUT = 300 * 1000
@@ -116,11 +116,13 @@ export class SQLiteCloudConnection {
116116
config.sqliteMode = parseBoolean(config.sqliteMode)
117117

118118
if (!config.username || !config.password || !config.host) {
119-
console.error(`SQLiteCloudConnection.validateConfiguration - missing arguments`, config)
119+
console.error('SQLiteCloudConnection.validateConfiguration - missing arguments', config)
120120
throw new SQLiteCloudError('The user, password and host arguments must be specified.', { errorCode: 'ERR_MISSING_ARGS' })
121121
}
122122

123123
if (!config.connectionString) {
124+
// build connection string from configuration, values are already validated
125+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
124126
config.connectionString = `sqlitecloud://${config.username}:${config.password}@${config.host}:${config.port}/${config.database}`
125127
}
126128

src/transport-tls.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ export class TlsSocketTransport implements ConnectionTransport {
162162
if (bufferString.length > 1000) {
163163
bufferString = bufferString.substring(0, 100) + '...' + bufferString.substring(bufferString.length - 40)
164164
}
165-
const elapsedMs = new Date().getTime() - startedOn.getTime()
165+
// const elapsedMs = new Date().getTime() - startedOn.getTime()
166166
// console.debug(`Receive: ${bufferString} - ${elapsedMs}ms`)
167167
}
168168

src/transport-ws.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ export class WebSocketTransport implements ConnectionTransport {
3131
console.assert(!this.connected, 'Connection already established')
3232
if (!this.socket) {
3333
this.config = config
34-
let connectionString = this.config.connectionString as string
35-
let gatewayUrl = this.config?.gatewayUrl || `ws://${this.config.host}:4000`
34+
const connectionString = this.config.connectionString as string
35+
const gatewayUrl = this.config?.gatewayUrl || `ws://${this.config.host as string}:4000`
3636
this.socket = io(gatewayUrl, { auth: { token: connectionString } })
3737
}
3838
callback?.call(this, null)
@@ -59,7 +59,9 @@ export class WebSocketTransport implements ConnectionTransport {
5959
const { data, metadata } = response
6060
if (data && metadata) {
6161
if (metadata.numberOfRows !== undefined && metadata.numberOfColumns !== undefined && metadata.columns !== undefined) {
62-
// we can recreate a SQLiteCloudRowset from the response
62+
console.assert(Array.isArray(data), 'SQLiteCloudWebsocketConnection.processCommands - data is not an array')
63+
// we can recreate a SQLiteCloudRowset from the response which we know to be an array of arrays
64+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
6365
const rowset = new SQLiteCloudRowset(metadata, data.flat())
6466
callback?.call(this, null, rowset)
6567
return

0 commit comments

Comments
 (0)