Skip to content

Commit 2ef5550

Browse files
authored
Merge pull request brianc#2161 from brianc/bmc/lint
Prettier the codebase
2 parents 41c899c + 3d9678e commit 2ef5550

File tree

154 files changed

+4063
-3274
lines changed

Some content is hidden

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

154 files changed

+4063
-3274
lines changed

.eslintrc

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
{
22
"plugins": [
3-
"node"
3+
"prettier"
44
],
5+
"parser": "@typescript-eslint/parser",
56
"extends": [
6-
"standard",
7-
"eslint:recommended",
8-
"plugin:node/recommended"
7+
"plugin:prettier/recommended",
8+
"prettier/@typescript-eslint"
99
],
1010
"ignorePatterns": [
11-
"**/*.ts"
11+
"node_modules",
12+
"packages/pg-protocol/dist/**/*"
1213
],
1314
"parserOptions": {
1415
"ecmaVersion": 2017,
@@ -18,17 +19,5 @@
1819
"node": true,
1920
"es6": true,
2021
"mocha": true
21-
},
22-
"rules": {
23-
"space-before-function-paren": "off",
24-
"node/no-unsupported-features/es-syntax": "off",
25-
"node/no-unpublished-require": [
26-
"error",
27-
{
28-
"allowModules": [
29-
"pg"
30-
]
31-
}
32-
]
3322
}
3423
}

package.json

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,28 @@
1010
"packages/*"
1111
],
1212
"scripts": {
13-
"test": "yarn lerna exec yarn test",
13+
"test": "yarn lint && yarn lerna exec yarn test",
1414
"build": "yarn lerna exec --scope pg-protocol yarn build",
1515
"pretest": "yarn build",
16-
"lint": "yarn lerna exec --parallel yarn lint"
16+
"lint": "!([[ -e node_modules/.bin/prettier ]]) || eslint '*/**/*.{js,ts,tsx}'"
1717
},
1818
"devDependencies": {
19+
"@typescript-eslint/eslint-plugin": "^2.27.0",
20+
"@typescript-eslint/parser": "^2.27.0",
21+
"eslint": "^6.8.0",
22+
"eslint-config-prettier": "^6.10.1",
23+
"eslint-plugin-node": "^11.1.0",
24+
"eslint-plugin-prettier": "^3.1.2",
1925
"lerna": "^3.19.0"
2026
},
21-
"dependencies": {}
27+
"optionalDependencies": {
28+
"prettier": "2.0.4"
29+
},
30+
"prettier": {
31+
"semi": false,
32+
"printWidth": 120,
33+
"arrowParens": "always",
34+
"trailingComma": "es5",
35+
"singleQuote": true
36+
}
2237
}

packages/pg-cursor/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,23 +44,23 @@ Cursor.prototype.submit = function (connection) {
4444

4545
con.parse(
4646
{
47-
text: this.text
47+
text: this.text,
4848
},
4949
true
5050
)
5151

5252
con.bind(
5353
{
5454
portal: this._portal,
55-
values: this.values
55+
values: this.values,
5656
},
5757
true
5858
)
5959

6060
con.describe(
6161
{
6262
type: 'P',
63-
name: this._portal // AWS Redshift requires a portal name
63+
name: this._portal, // AWS Redshift requires a portal name
6464
},
6565
true
6666
)
@@ -165,7 +165,7 @@ Cursor.prototype._getRows = function (rows, cb) {
165165
this._rows = []
166166
const msg = {
167167
portal: this._portal,
168-
rows: rows
168+
rows: rows,
169169
}
170170
this.connection.execute(msg, true)
171171
this.connection.flush()

packages/pg-cursor/package.json

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
"test": "test"
88
},
99
"scripts": {
10-
"test": "mocha && eslint .",
11-
"lint": "eslint ."
10+
"test": "mocha"
1211
},
1312
"repository": {
1413
"type": "git",
@@ -17,17 +16,7 @@
1716
"author": "Brian M. Carlson",
1817
"license": "MIT",
1918
"devDependencies": {
20-
"eslint": "^6.5.1",
21-
"eslint-config-prettier": "^6.4.0",
22-
"eslint-plugin-prettier": "^3.1.1",
2319
"mocha": "^6.2.2",
24-
"pg": "^8.0.2",
25-
"prettier": "^1.18.2"
26-
},
27-
"prettier": {
28-
"semi": false,
29-
"printWidth": 120,
30-
"trailingComma": "none",
31-
"singleQuote": true
20+
"pg": "^8.0.2"
3221
}
3322
}

packages/pg-cursor/test/error-handling.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ const pg = require('pg')
55

66
const text = 'SELECT generate_series as num FROM generate_series(0, 4)'
77

8-
describe('error handling', function() {
9-
it('can continue after error', function(done) {
8+
describe('error handling', function () {
9+
it('can continue after error', function (done) {
1010
const client = new pg.Client()
1111
client.connect()
1212
const cursor = client.query(new Cursor('asdfdffsdf'))
13-
cursor.read(1, function(err) {
13+
cursor.read(1, function (err) {
1414
assert(err)
15-
client.query('SELECT NOW()', function(err) {
15+
client.query('SELECT NOW()', function (err) {
1616
assert.ifError(err)
1717
client.end()
1818
done()
@@ -22,16 +22,16 @@ describe('error handling', function() {
2222
})
2323

2424
describe('read callback does not fire sync', () => {
25-
it('does not fire error callback sync', done => {
25+
it('does not fire error callback sync', (done) => {
2626
const client = new pg.Client()
2727
client.connect()
2828
const cursor = client.query(new Cursor('asdfdffsdf'))
2929
let after = false
30-
cursor.read(1, function(err) {
30+
cursor.read(1, function (err) {
3131
assert(err, 'error should be returned')
3232
assert.strictEqual(after, true, 'should not call read sync')
3333
after = false
34-
cursor.read(1, function(err) {
34+
cursor.read(1, function (err) {
3535
assert(err, 'error should be returned')
3636
assert.strictEqual(after, true, 'should not call read sync')
3737
client.end()
@@ -42,18 +42,18 @@ describe('read callback does not fire sync', () => {
4242
after = true
4343
})
4444

45-
it('does not fire result sync after finished', done => {
45+
it('does not fire result sync after finished', (done) => {
4646
const client = new pg.Client()
4747
client.connect()
4848
const cursor = client.query(new Cursor('SELECT NOW()'))
4949
let after = false
50-
cursor.read(1, function(err) {
50+
cursor.read(1, function (err) {
5151
assert(!err)
5252
assert.strictEqual(after, true, 'should not call read sync')
53-
cursor.read(1, function(err) {
53+
cursor.read(1, function (err) {
5454
assert(!err)
5555
after = false
56-
cursor.read(1, function(err) {
56+
cursor.read(1, function (err) {
5757
assert(!err)
5858
assert.strictEqual(after, true, 'should not call read sync')
5959
client.end()
@@ -66,16 +66,16 @@ describe('read callback does not fire sync', () => {
6666
})
6767
})
6868

69-
describe('proper cleanup', function() {
70-
it('can issue multiple cursors on one client', function(done) {
69+
describe('proper cleanup', function () {
70+
it('can issue multiple cursors on one client', function (done) {
7171
const client = new pg.Client()
7272
client.connect()
7373
const cursor1 = client.query(new Cursor(text))
74-
cursor1.read(8, function(err, rows) {
74+
cursor1.read(8, function (err, rows) {
7575
assert.ifError(err)
7676
assert.strictEqual(rows.length, 5)
7777
const cursor2 = client.query(new Cursor(text))
78-
cursor2.read(8, function(err, rows) {
78+
cursor2.read(8, function (err, rows) {
7979
assert.ifError(err)
8080
assert.strictEqual(rows.length, 5)
8181
client.end()

0 commit comments

Comments
 (0)