Skip to content

Commit 4b93e49

Browse files
authored
Standardise code and fix linter issues (#919)
Fix and apply the configured standard to the code base makes easier for the next changes go through the pipeline without have to mess up with tech debts. This also enables the lint stage be part of test routine, not only in the pre-commit hook (which could be by passed).
1 parent 1cfc700 commit 4b93e49

File tree

169 files changed

+2046
-2012
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

169 files changed

+2046
-2012
lines changed

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@
4949
"lerna": "lerna",
5050
"prepare": "husky install",
5151
"lint-staged": "lint-staged",
52+
"lint": "npm run lint::core && npm run lint::bolt-connection && npm run lint::bolt-connection && npm run lint::neo4j-driver-lite && npm run lint::neo4j-driver && npm run lint::testkit-backend",
53+
"lint::core": "npm run ts-standard::core -- packages/core/src/ && npm run ts-standard::core -- packages/core/test/",
54+
"lint::bolt-connection": "npm run ts-standard::bolt-connection -- packages/bolt-connection/types/ && npm run standard -- packages/bolt-connection/src/ && npm run standard -- packages/bolt-connection/test/",
55+
"lint::neo4j-driver-lite": "npm run ts-standard::neo4j-driver-lite -- packages/neo4j-driver-lite/src/ && npm run ts-standard::neo4j-driver-lite -- packages/neo4j-driver-lite/test/",
56+
"lint::neo4j-driver": "npm run ts-standard::neo4j-driver -- packages/neo4j-driver/types/ && npm run ts-standard::neo4j-driver -- packages/neo4j-driver/test/types/ && npm run standard -- packages/neo4j-driver/src/ && npm run standard -- packages/neo4j-driver/test/**/*.js",
57+
"lint::testkit-backend": "npm run standard -- packages/testkit-backend/src/**/*.js",
5258
"ts-standard": "npm run ts-standard::core && npm run ts-standard::bolt-connection && npm run ts-standard::neo4j-driver-lite && npm run ts-standard::neo4j-driver",
5359
"ts-standard::core": "ts-standard --fix --project ./packages/core/tsconfig.json",
5460
"ts-standard::bolt-connection": "ts-standard --fix --project ./packages/bolt-connection/tsconfig.json",

packages/bolt-connection/src/bolt/bolt-protocol-util.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* limitations under the License.
1818
*/
1919
import { newError } from 'neo4j-driver-core'
20+
// eslint-disable-next-line no-unused-vars
2021
import { ResultStreamObserver } from './stream-observers'
2122

2223
/**
@@ -59,7 +60,7 @@ function assertDatabaseIsEmpty (database, onProtocolError = () => {}, observer)
5960

6061
/**
6162
* Asserts that the passed-in impersonated user is empty
62-
* @param {string} impersonatedUser
63+
* @param {string} impersonatedUser
6364
* @param {function (err:Error)} onProtocolError Called when it does have impersonated user set
6465
* @param {any} observer
6566
*/

packages/bolt-connection/src/bolt/bolt-protocol-v1.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,23 @@ import {
2121
assertTxConfigIsEmpty,
2222
assertImpersonatedUserIsEmpty
2323
} from './bolt-protocol-util'
24+
// eslint-disable-next-line no-unused-vars
2425
import { Chunker } from '../channel'
2526
import { v1 } from '../packstream'
2627
import RequestMessage from './request-message'
2728
import {
2829
LoginObserver,
2930
ResetObserver,
3031
ResultStreamObserver,
32+
// eslint-disable-next-line no-unused-vars
3133
StreamObserver
3234
} from './stream-observers'
3335
import { internal } from 'neo4j-driver-core'
3436

3537
const {
3638
bookmarks: { Bookmarks },
3739
constants: { ACCESS_MODE_WRITE, BOLT_PROTOCOL_V1 },
40+
// eslint-disable-next-line no-unused-vars
3841
logger: { Logger },
3942
txConfig: { TxConfig }
4043
} = internal

packages/bolt-connection/src/bolt/bolt-protocol-v3.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import {
2828
import { internal } from 'neo4j-driver-core'
2929

3030
const {
31+
// eslint-disable-next-line no-unused-vars
3132
bookmarks: { Bookmarks },
3233
constants: { BOLT_PROTOCOL_V3 },
3334
txConfig: { TxConfig }

packages/bolt-connection/src/bolt/bolt-protocol-v4x0.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
import { internal } from 'neo4j-driver-core'
2828

2929
const {
30+
// eslint-disable-next-line no-unused-vars
3031
bookmarks: { Bookmarks },
3132
constants: { BOLT_PROTOCOL_V4_0, FETCH_ALL },
3233
txConfig: { TxConfig }

packages/bolt-connection/src/bolt/bolt-protocol-v4x4.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ import { RouteObserver, ResultStreamObserver } from './stream-observers'
2424

2525
const {
2626
constants: { BOLT_PROTOCOL_V4_4, FETCH_ALL },
27-
bookmarks: { Bookmarks },
27+
bookmarks: { Bookmarks }
2828
} = internal
2929

3030
export default class BoltProtocol extends BoltProtocolV43 {
31-
get version() {
31+
get version () {
3232
return BOLT_PROTOCOL_V4_4
3333
}
3434

@@ -153,5 +153,4 @@ export default class BoltProtocol extends BoltProtocolV43 {
153153

154154
return observer
155155
}
156-
157156
}

packages/bolt-connection/src/bolt/bolt-protocol-v5x0.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ import { v5 } from '../packstream'
2222
import { internal } from 'neo4j-driver-core'
2323

2424
const {
25-
constants: { BOLT_PROTOCOL_V5_0 },
25+
constants: { BOLT_PROTOCOL_V5_0 }
2626
} = internal
2727

2828
export default class BoltProtocol extends BoltProtocolV44 {
29-
get version() {
29+
get version () {
3030
return BOLT_PROTOCOL_V5_0
3131
}
3232

packages/bolt-connection/src/bolt/create.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import BoltProtocolV4x2 from './bolt-protocol-v4x2'
2727
import BoltProtocolV4x3 from './bolt-protocol-v4x3'
2828
import BoltProtocolV4x4 from './bolt-protocol-v4x4'
2929
import BoltProtocolV5x0 from './bolt-protocol-v5x0'
30+
// eslint-disable-next-line no-unused-vars
3031
import { Chunker, Dechunker } from '../channel'
3132
import ResponseHandler from './response-handler'
3233

packages/bolt-connection/src/bolt/request-message.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,14 +250,14 @@ export default class RequestMessage {
250250
* @param {string} databaseContext.impersonatedUser The name of the user to impersonation when getting the routing table.
251251
* @return {RequestMessage} the ROUTE message.
252252
*/
253-
static routeV4x4 (routingContext = {}, bookmarks = [], databaseContext = {}) {
253+
static routeV4x4 (routingContext = {}, bookmarks = [], databaseContext = {}) {
254254
const dbContext = {}
255255

256-
if ( databaseContext.databaseName ) {
256+
if (databaseContext.databaseName) {
257257
dbContext.db = databaseContext.databaseName
258258
}
259259

260-
if ( databaseContext.impersonatedUser ) {
260+
if (databaseContext.impersonatedUser) {
261261
dbContext.imp_user = databaseContext.impersonatedUser
262262
}
263263

packages/bolt-connection/src/bolt/response-handler.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,5 +193,4 @@ export default class ResponseHandler {
193193
_resetFailure () {
194194
this._currentFailure = null
195195
}
196-
197196
}

0 commit comments

Comments
 (0)