Fix eslint and add back standard (#1928)

* 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
This commit is contained in:
Sehrope Sarkuni 2019-07-25 14:00:14 -04:00 committed by Brian C
parent 0894a3ce07
commit 3ead900349
7 changed files with 15 additions and 7 deletions

View File

@ -3,6 +3,7 @@
"node"
],
"extends": [
"standard",
"eslint:recommended",
"plugin:node/recommended"
],

View File

@ -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

View File

@ -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] ||

View File

@ -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]
}
}

View File

@ -50,7 +50,7 @@ module.exports = {
ssl: false,
application_name: undefined,
fallback_application_name: undefined,
parseInputDatesAsUTC: false,

View File

@ -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',

View File

@ -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",