Skip to content

Commit 98c9820

Browse files
committed
Enforce stricter JS coding style rules
1 parent 4d6e155 commit 98c9820

File tree

267 files changed

+3307
-3284
lines changed

Some content is hidden

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

267 files changed

+3307
-3284
lines changed

.eslintrc

+28-1
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,38 @@
33
"ecmaVersion": 2019
44
},
55
"rules": {
6+
require-await: "error",
7+
brace-style: "error",
8+
computed-property-spacing: ["error", "never"],
9+
comma-spacing: [
10+
"error", {
11+
"before": false,
12+
"after": true
13+
}
14+
],
15+
no-trailing-spaces: "error",
16+
"space-before-function-paren": [
17+
"error", {
18+
"anonymous": "never",
19+
"named": "never",
20+
"asyncArrow": "always"
21+
}
22+
],
23+
space-in-parens: "error",
24+
space-infix-ops: "error",
25+
"space-unary-ops": [
26+
2, {
27+
"words": true,
28+
"nonwords": false
29+
}
30+
],
31+
space-before-blocks: "error",
32+
keyword-spacing: "error",
33+
eol-last: "error",
634
"indent": [
735
2,
836
2,
937
{ "SwitchCase": 1 /*, "VariableDeclarator": { "var": 2} */},
10-
1138
],
1239
"quotes": [
1340
0,

examples/blobhttp.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. */
1+
/* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. */
22

33
/******************************************************************************
44
*
@@ -140,7 +140,7 @@ async function closePoolAndExit() {
140140
await oracledb.getPool().close(2);
141141
console.log('Pool closed');
142142
process.exit(0);
143-
} catch(err) {
143+
} catch (err) {
144144
console.error(err.message);
145145
process.exit(1);
146146
}

examples/connectionpool.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ async function closePoolAndExit() {
118118
await oracledb.getPool().close(10);
119119
console.log('Pool closed');
120120
process.exit(0);
121-
} catch(err) {
121+
} catch (err) {
122122
console.error(err.message);
123123
process.exit(1);
124124
}

examples/cqn1.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. */
1+
/* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. */
22

33
/******************************************************************************
44
*
@@ -45,8 +45,7 @@ const interval = setInterval(function() {
4545
console.log("waiting...");
4646
}, 5000);
4747

48-
function myCallback(message)
49-
{
48+
function myCallback(message) {
5049
// message.type is one of the oracledb.SUBSCR_EVENT_TYPE_* values
5150
console.log("Message type:", message.type);
5251
if (message.type == oracledb.SUBSCR_EVENT_TYPE_DEREG) {
@@ -100,7 +99,7 @@ async function setup(connection) {
10099
for (const s of stmts) {
101100
try {
102101
await connection.execute(s);
103-
} catch(e) {
102+
} catch (e) {
104103
if (e.errorNum != 942)
105104
console.error(e);
106105
}

examples/cqn2.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. */
1+
/* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. */
22

33
/******************************************************************************
44
*
@@ -46,8 +46,7 @@ const interval = setInterval(function() {
4646
console.log("waiting...");
4747
}, 5000);
4848

49-
function myCallback(message)
50-
{
49+
function myCallback(message) {
5150
// message.type is one of the oracledb.SUBSCR_EVENT_TYPE_* values
5251
console.log("Message type:", message.type);
5352
if (message.type == oracledb.SUBSCR_EVENT_TYPE_DEREG) {
@@ -100,7 +99,7 @@ async function setup(connection) {
10099
for (const s of stmts) {
101100
try {
102101
await connection.execute(s);
103-
} catch(e) {
102+
} catch (e) {
104103
if (e.errorNum != 942)
105104
console.error(e);
106105
}

examples/date.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. */
1+
/* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. */
22

33
/******************************************************************************
44
*
@@ -62,7 +62,7 @@ async function run() {
6262
for (const s of stmts) {
6363
try {
6464
await connection.execute(s);
65-
} catch(e) {
65+
} catch (e) {
6666
if (e.errorNum != 942)
6767
console.error(e);
6868
}
@@ -75,7 +75,7 @@ async function run() {
7575
`INSERT INTO no_datetab (id, timestampcol, timestamptz, timestampltz, datecol)
7676
VALUES (1, :ts, :tstz, :tsltz, :td)`,
7777
{ ts: date, tstz: date, tsltz: date, td: date });
78-
console.log('Rows inserted: ' + result.rowsAffected );
78+
console.log('Rows inserted: ' + result.rowsAffected);
7979

8080
console.log('Query Results:');
8181
result = await connection.execute(
@@ -94,7 +94,7 @@ async function run() {
9494
`INSERT INTO no_datetab (id, timestampcol, timestamptz, timestampltz, datecol)
9595
VALUES (2, :ts, :tstz, :tsltz, :td)`,
9696
{ ts: date, tstz: date, tsltz: date, td: date });
97-
console.log('Rows inserted: ' + result.rowsAffected );
97+
console.log('Rows inserted: ' + result.rowsAffected);
9898

9999
console.log('Query Results:');
100100
result = await connection.execute(

examples/dbmsoutputpipe.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. */
1+
/* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. */
22

33
/******************************************************************************
44
*
@@ -57,7 +57,7 @@ async function run() {
5757
for (const s of stmts) {
5858
try {
5959
await connection.execute(s);
60-
} catch(e) {
60+
} catch (e) {
6161
if (e.errorNum != 942)
6262
console.error(e);
6363
}

examples/demodrop.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. */
1+
/* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. */
22

33
/******************************************************************************
44
*
@@ -114,7 +114,7 @@ async function run() {
114114
try {
115115
console.log(s);
116116
await connection.execute(s);
117-
} catch(e) {
117+
} catch (e) {
118118
// do nothing
119119
}
120120
}

examples/demosetup.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. */
1+
/* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. */
22

33
/******************************************************************************
44
*
@@ -60,9 +60,9 @@ async function setupBf(connection) {
6060
for (const s of stmts) {
6161
try {
6262
await connection.execute(s);
63-
} catch(e) {
63+
} catch (e) {
6464
if (e.errorNum != 942)
65-
throw(e);
65+
throw (e);
6666
}
6767
}
6868
await connection.commit();
@@ -113,9 +113,9 @@ async function setupLobs(connection, insertData) {
113113
for (const s of stmts) {
114114
try {
115115
await connection.execute(s);
116-
} catch(e) {
116+
} catch (e) {
117117
if (e.errorNum != 942)
118-
throw(e);
118+
throw (e);
119119
}
120120
}
121121

@@ -230,9 +230,9 @@ async function setupEm(connection) {
230230
for (const s of stmts) {
231231
try {
232232
await connection.execute(s);
233-
} catch(e) {
233+
} catch (e) {
234234
if (e.errorNum != 942)
235-
throw(e);
235+
throw (e);
236236
}
237237
}
238238
await connection.commit();

examples/dmlrupd1.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. */
1+
/* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. */
22

33
/******************************************************************************
44
*
@@ -27,7 +27,7 @@
2727
*
2828
*****************************************************************************/
2929

30-
const oracledb = require( 'oracledb' );
30+
const oracledb = require('oracledb');
3131
const dbConfig = require('./dbconfig.js');
3232

3333
async function run() {
@@ -54,7 +54,7 @@ async function run() {
5454
for (const s of stmts) {
5555
try {
5656
await connection.execute(s);
57-
} catch(e) {
57+
} catch (e) {
5858
if (e.errorNum != 942)
5959
console.error(e);
6060
}

examples/dmlrupd2.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. */
1+
/* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. */
22

33
/******************************************************************************
44
*
@@ -27,7 +27,7 @@
2727
*
2828
*****************************************************************************/
2929

30-
const oracledb = require( 'oracledb' );
30+
const oracledb = require('oracledb');
3131
const dbConfig = require('./dbconfig.js');
3232

3333
async function run() {
@@ -54,7 +54,7 @@ async function run() {
5454
for (const s of stmts) {
5555
try {
5656
await connection.execute(s);
57-
} catch(e) {
57+
} catch (e) {
5858
if (e.errorNum != 942)
5959
console.error(e);
6060
}

examples/endtoend.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. */
1+
/* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. */
22

33
/******************************************************************************
44
*
@@ -46,7 +46,7 @@ async function run() {
4646
connection.action = "Query departments";
4747

4848
console.log("Use SQL*Plus as SYSTEM (or ADMIN for Oracle Cloud databases) to execute the query:");
49-
console.log(" SELECT username, client_identifier, action, module FROM v$session WHERE username = UPPER('" + dbConfig.user +"');");
49+
console.log(" SELECT username, client_identifier, action, module FROM v$session WHERE username = UPPER('" + dbConfig.user + "');");
5050

5151
// Sleep 10 seconds to keep the connection open. This allows
5252
// external queries on V$SESSION to show the connection

examples/example.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. */
1+
/* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. */
22

33
/******************************************************************************
44
*
@@ -66,7 +66,7 @@ async function run() {
6666
for (const s of stmts) {
6767
try {
6868
await connection.execute(s);
69-
} catch(e) {
69+
} catch (e) {
7070
if (e.errorNum != 942)
7171
console.error(e);
7272
}

examples/insert1.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. */
1+
/* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. */
22

33
/******************************************************************************
44
*
@@ -51,7 +51,7 @@ async function run() {
5151
for (const s of stmts) {
5252
try {
5353
await connection.execute(s);
54-
} catch(e) {
54+
} catch (e) {
5555
if (e.errorNum != 942)
5656
console.error(e);
5757
}

examples/insert2.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. */
1+
/* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. */
22

33
/******************************************************************************
44
*
@@ -57,7 +57,7 @@ async function run() {
5757
for (const s of stmts) {
5858
try {
5959
await connection1.execute(s);
60-
} catch(e) {
60+
} catch (e) {
6161
if (e.errorNum != 942)
6262
console.error(e);
6363
}

examples/plsqlarray.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. */
1+
/* Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. */
22

33
/******************************************************************************
44
*
@@ -93,7 +93,7 @@ async function run() {
9393
for (const s of stmts) {
9494
try {
9595
await connection.execute(s);
96-
} catch(e) {
96+
} catch (e) {
9797
if (e.errorNum != 942)
9898
console.error(e);
9999
}

examples/plsqlrecord.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. */
1+
/* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. */
22

33
/******************************************************************************
44
*
@@ -64,7 +64,7 @@ async function run() {
6464
for (const s of stmts) {
6565
try {
6666
await connection.execute(s);
67-
} catch(e) {
67+
} catch (e) {
6868
console.error(e);
6969
}
7070
}

examples/plsqlvarrayrecord.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. */
1+
/* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. */
22

33
/******************************************************************************
44
*
@@ -70,7 +70,7 @@ async function run() {
7070
for (const s of stmts) {
7171
try {
7272
await connection.execute(s);
73-
} catch(e) {
73+
} catch (e) {
7474
console.error(e);
7575
}
7676
}

examples/raw.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. */
1+
/* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. */
22

33
/******************************************************************************
44
*
@@ -50,7 +50,7 @@ async function run() {
5050
for (const s of stmts) {
5151
try {
5252
await connection.execute(s);
53-
} catch(e) {
53+
} catch (e) {
5454
if (e.errorNum != 942)
5555
console.error(e);
5656
}

0 commit comments

Comments
 (0)