diff --git a/.eslintrc.js b/.eslintrc.js index 96acaa0..87c4260 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -37,12 +37,14 @@ module.exports = { usePrettierrc: true, }, ], + 'arrow-body-style': ['error', 'as-needed', { requireReturnForObjectLiteral: true }], curly: ['error', 'all'], 'callback-return': ['error', ['callback', 'cb', 'next', 'done']], 'class-methods-use-this': 'off', 'consistent-return': 'off', 'handle-callback-err': ['error', '^.*err'], 'new-cap': 'off', + 'no-confusing-arrow': ['error', { allowParens: false }], 'no-console': 'error', 'no-else-return': 'error', 'no-eq-null': 'off', @@ -184,7 +186,6 @@ module.exports = { 'plugin:@typescript-eslint/recommended', 'plugin:@typescript-eslint/recommended-requiring-type-checking', 'prettier', - 'prettier/@typescript-eslint', 'plugin:prettier/recommended', ], rules: { diff --git a/.husky/pre-commit b/.husky/pre-commit index a9cb124..f9ab070 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,5 +1,8 @@ #!/bin/sh -. "$(dirname $0)/_/husky.sh" +# shellcheck disable=SC1090,SC1091 +. "$(dirname "$0")/_/husky.sh" -echo 'NOTE: If node is not found, you may need to run brew link for your specific node version' -/usr/local/bin/node node_modules/.bin/lint-staged +PATH=$PATH:/usr/local/bin + +echo 'NOTE: If node or npm is not found, you may need to run brew link for your specific node version' +npm run lint-staged diff --git a/package.json b/package.json index e09a186..ac411b2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bigal", - "version": "6.0.2", + "version": "7.0.0", "description": "A fast and lightweight orm for postgres and node.js, written in typescript.", "main": "index.js", "types": "index.d.ts", @@ -19,45 +19,46 @@ "node": ">=10" }, "dependencies": { - "@types/lodash": "^4.14.167", - "@types/node": "^14.14.20", - "@types/pg": "^7.14.7", - "lodash": "^4.17.20", + "@types/lodash": "^4.14.168", + "@types/node": "^14.14.31", + "@types/pg": "^7.14.10", + "lodash": "^4.17.21", "pg": "8.5.1", - "postgres-pool": "^3.2.5" + "postgres-pool": "^3.2.7" }, "devDependencies": { - "@types/chai": "^4.2.14", - "@types/faker": "^5.1.5", - "@types/mocha": "^8.2.0", - "@typescript-eslint/eslint-plugin": "^4.13.0", - "@typescript-eslint/parser": "^4.13.0", - "chai": "^4.2.0", - "eslint": "^7.17.0", + "@types/chai": "^4.2.15", + "@types/faker": "^5.1.7", + "@types/mocha": "^8.2.1", + "@typescript-eslint/eslint-plugin": "^4.15.2", + "@typescript-eslint/parser": "^4.15.2", + "chai": "^4.3.0", + "eslint": "^7.20.0", "eslint-config-airbnb-base": "^14.2.1", - "eslint-config-airbnb-typescript": "^12.0.0", - "eslint-config-prettier": "^7.1.0", + "eslint-config-airbnb-typescript": "^12.3.1", + "eslint-config-prettier": "^8.1.0", "eslint-plugin-import": "^2.22.1", - "eslint-plugin-jsdoc": "^31.0.3", + "eslint-plugin-jsdoc": "^32.2.0", "eslint-plugin-mocha": "^8.0.0", "eslint-plugin-prettier": "^3.3.1", - "eslint-plugin-promise": "^4.2.1", + "eslint-plugin-promise": "^4.3.1", "eslint-plugin-security": "^1.4.0", - "faker": "^5.1.0", - "husky": "^5.0.6", - "lint-staged": "^10.5.3", - "mocha": "^8.2.1", - "pinst": "^2.1.1", + "faker": "^5.4.0", + "husky": "^5.1.1", + "lint-staged": "^10.5.4", + "mocha": "^8.3.0", + "pinst": "^2.1.6", "prettier": "^2.2.1", "strict-event-emitter-types": "^2.0.0", "ts-mockito": "^2.6.1", "ts-node": "^9.1.1", - "typescript": "^4.1.3" + "typescript": "^4.2.2" }, "scripts": { "build": "tsc", "test": "mocha -r ts-node/register tests/**/*.tests.ts", "lint": "eslint --fix --ext .ts src tests", + "lint-staged": "lint-staged", "dist": "if [ -d \"src\" ]; then rm -rf dist && npm run build && npm run lint && npm run test && cp package.json dist && cp *.md dist && cp LICENSE dist && cp .npmignore dist && cd dist && npm publish; fi", "prepublishOnly": "if [ -d \"src\" ]; then echo \"Please use: npm run dist\" && exit 125; fi && pinst --disable", "postinstall": "husky install", diff --git a/src/ReadonlyRepository.ts b/src/ReadonlyRepository.ts index 3ec020d..6e86599 100644 --- a/src/ReadonlyRepository.ts +++ b/src/ReadonlyRepository.ts @@ -317,10 +317,10 @@ export class ReadonlyRepository implements IReadonlyRepository { await Promise.all(populateQueries); } - return resolve(result); + return await resolve(result); } - return resolve(null); + return await resolve(null); } catch (ex) { const typedException = ex as Error; if (typedException.stack) {