Skip to content

Commit

Permalink
Fix eslint and add back standard (#1928)
Browse files Browse the repository at this point in the history
* lint: Enable standard rules again

* lint: Replace hasOwnProperty(...) call

* lint: Remove trailing spaces

* lint: Remove spaces within array brackets

* lint: Disable quote-props to silence linter

* lint: Skip linting on older node versions
  • Loading branch information
sehrope authored and brianc committed Jul 25, 2019
1 parent 0894a3c commit 3ead900
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 7 deletions.
1 change: 1 addition & 0 deletions .eslintrc
Expand Up @@ -3,6 +3,7 @@
"node"
],
"extends": [
"standard",
"eslint:recommended",
"plugin:node/recommended"
],
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Expand Up @@ -62,4 +62,6 @@ test-pool:

lint:
@echo "***Starting lint***"
node_modules/.bin/eslint lib
node -e "process.exit(Number(process.versions.node.split('.')[0]) < 8 ? 0 : 1)" \
&& echo "***Skipping lint (node version too old)***" \
|| node_modules/.bin/eslint lib
4 changes: 2 additions & 2 deletions lib/connection-parameters.js
Expand Up @@ -15,11 +15,11 @@ var parse = require('pg-connection-string').parse // parses a connection string

var val = function (key, config, envVar) {
if (envVar === undefined) {
envVar = process.env[ 'PG' + key.toUpperCase() ]
envVar = process.env['PG' + key.toUpperCase()]
} else if (envVar === false) {
// do nothing ... use false
} else {
envVar = process.env[ envVar ]
envVar = process.env[envVar]
}

return config[key] ||
Expand Down
2 changes: 1 addition & 1 deletion lib/connection.js
Expand Up @@ -604,7 +604,7 @@ Connection.prototype.parseE = function (buffer, length) {
msg = new Error(fields.M)
for (item in input) {
// copy input properties to the error
if (input.hasOwnProperty(item)) {
if (Object.prototype.hasOwnProperty.call(input, item)) {
msg[item] = input[item]
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/defaults.js
Expand Up @@ -50,7 +50,7 @@ module.exports = {
ssl: false,

application_name: undefined,

fallback_application_name: undefined,

parseInputDatesAsUTC: false,
Expand Down
1 change: 1 addition & 0 deletions lib/native/query.js
Expand Up @@ -35,6 +35,7 @@ var NativeQuery = module.exports = function (config, values, callback) {
util.inherits(NativeQuery, EventEmitter)

var errorFieldMap = {
/* eslint-disable quote-props */
'sqlState': 'code',
'statementPosition': 'position',
'messagePrimary': 'message',
Expand Down
8 changes: 6 additions & 2 deletions package.json
Expand Up @@ -31,8 +31,12 @@
"async": "0.9.0",
"bluebird": "3.5.2",
"co": "4.6.0",
"eslint": "^4.19.1",
"eslint-plugin-node": "^6.0.1",
"eslint": "^6.0.1",
"eslint-config-standard": "^13.0.1",
"eslint-plugin-import": "^2.18.1",
"eslint-plugin-node": "^9.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.0",
"pg-copy-streams": "0.3.0"
},
"minNativeVersion": "2.0.0",
Expand Down

0 comments on commit 3ead900

Please sign in to comment.