diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000000..823a412fc7 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,32 @@ +module.exports = { + root: true, + env: { + node: true + }, + parser: "@typescript-eslint/parser", + parserOptions: { + project: ['./tsconfig.json'] + }, + plugins: [ + "@typescript-eslint" + ], + extends: [ + "eslint:recommended", + "plugin:@typescript-eslint/eslint-recommended", + "plugin:@typescript-eslint/recommended", + "plugin:@typescript-eslint/recommended-requiring-type-checking" + ], + ignorePatterns: ["**/*.js"], + rules: { + "no-prototype-builtins": "off", + "@typescript-eslint/no-inferrable-types": "off", + "@typescript-eslint/no-non-null-assertion": "off", + "@typescript-eslint/no-unused-vars": "off", + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/member-ordering": "error", + "@typescript-eslint/unbound-method": ["error", { + "ignoreStatic": true + }], + "@typescript-eslint/prefer-includes": "off" + } +}; diff --git a/gulpfile.ts b/gulpfile.ts index 96793016f7..942df7647f 100644 --- a/gulpfile.ts +++ b/gulpfile.ts @@ -4,11 +4,11 @@ import * as gulp from "gulp"; import * as del from "del"; import * as shell from "gulp-shell"; import * as replace from "gulp-replace"; -import tslintPlugin from "gulp-tslint"; import * as ts from "gulp-typescript"; import * as sourcemaps from "gulp-sourcemaps"; import { rollup, RollupOptions, Plugin } from "rollup"; import { terser as rollupTerser } from "rollup-plugin-terser"; +import * as childProcess from "child_process"; const pkg = require("./package.json"); @@ -68,7 +68,7 @@ export class Gulpfile { */ @Task() runTests() { - return require("child_process").spawn("npx jest --coverage", { + return childProcess.spawn("npx jest --coverage", { stdio: 'inherit', shell: true }); @@ -222,15 +222,14 @@ export class Gulpfile { // ------------------------------------------------------------------------- /** - * Runs ts linting to validate source code. + * Runs es linting to validate source code. */ @Task() - tslint() { - return gulp.src(["./src/**/*.ts", "./test/**/*.ts", "./sample/**/*.ts"]) - .pipe(tslintPlugin()) - .pipe(tslintPlugin.report({ - emitError: true - })); + eslint() { + return childProcess.spawn("npx eslint --config ./.eslintrc.js --ext .ts ./src ./test", { + stdio: 'inherit', + shell: true + }); } /** @@ -238,7 +237,7 @@ export class Gulpfile { */ @SequenceTask() tests() { - return ["clean", "tslint", "runTests"]; + return ["clean", "eslint", "runTests"]; } private _rollupPackageBundleEsm5(isMin: boolean) { diff --git a/package-lock.json b/package-lock.json index dda84e14d2..d104e5e256 100644 --- a/package-lock.json +++ b/package-lock.json @@ -341,6 +341,15 @@ "@babel/helper-plugin-utils": "^7.8.0" } }, + "@babel/runtime": { + "version": "7.9.6", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.9.6.tgz", + "integrity": "sha512-64AF1xY3OAkFHqOb9s4jpgk1Mm5vDZ4L3acHvAml+53nO1XbXLuDodsVpO4OIUsmemlUHMxNdYMNJmsvOwLrvQ==", + "dev": true, + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, "@babel/template": { "version": "7.8.6", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.8.6.tgz", @@ -1237,6 +1246,12 @@ "del": "*" } }, + "@types/eslint-visitor-keys": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz", + "integrity": "sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag==", + "dev": true + }, "@types/estree": { "version": "0.0.39", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", @@ -1359,6 +1374,12 @@ "pretty-format": "^25.2.1" } }, + "@types/json-schema": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.4.tgz", + "integrity": "sha512-8+KAKzEvSUdeo+kmqnKrqgeE+LcA0tjYWFY7RPProVYwnqDjukzO+3b6dLD56rYX5TdWejnEOLJYOIeh4CXKuA==", + "dev": true + }, "@types/merge2": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/@types/merge2/-/merge2-1.1.4.tgz", @@ -1513,6 +1534,109 @@ "integrity": "sha512-FA/BWv8t8ZWJ+gEOnLLd8ygxH/2UFbAvgEonyfN6yWGLKc7zVjbpl2Y4CTjid9h2RfgPP6SEt6uHwEOply00yw==", "dev": true }, + "@typescript-eslint/eslint-plugin": { + "version": "2.29.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.29.0.tgz", + "integrity": "sha512-X/YAY7azKirENm4QRpT7OVmzok02cSkqeIcLmdz6gXUQG4Hk0Fi9oBAynSAyNXeGdMRuZvjBa0c1Lu0dn/u6VA==", + "dev": true, + "requires": { + "@typescript-eslint/experimental-utils": "2.29.0", + "functional-red-black-tree": "^1.0.1", + "regexpp": "^3.0.0", + "tsutils": "^3.17.1" + } + }, + "@typescript-eslint/experimental-utils": { + "version": "2.29.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.29.0.tgz", + "integrity": "sha512-H/6VJr6eWYstyqjWXBP2Nn1hQJyvJoFdDtsHxGiD+lEP7piGnGpb/ZQd+z1ZSB1F7dN+WsxUDh8+S4LwI+f3jw==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.3", + "@typescript-eslint/typescript-estree": "2.29.0", + "eslint-scope": "^5.0.0", + "eslint-utils": "^2.0.0" + } + }, + "@typescript-eslint/parser": { + "version": "2.29.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.29.0.tgz", + "integrity": "sha512-H78M+jcu5Tf6m/5N8iiFblUUv+HJDguMSdFfzwa6vSg9lKR8Mk9BsgeSjO8l2EshKnJKcbv0e8IDDOvSNjl0EA==", + "dev": true, + "requires": { + "@types/eslint-visitor-keys": "^1.0.0", + "@typescript-eslint/experimental-utils": "2.29.0", + "@typescript-eslint/typescript-estree": "2.29.0", + "eslint-visitor-keys": "^1.1.0" + } + }, + "@typescript-eslint/typescript-estree": { + "version": "2.29.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.29.0.tgz", + "integrity": "sha512-3YGbtnWy4az16Egy5Fj5CckkVlpIh0MADtAQza+jiMADRSKkjdpzZp/5WuvwK/Qib3Z0HtzrDFeWanS99dNhnA==", + "dev": true, + "requires": { + "debug": "^4.1.1", + "eslint-visitor-keys": "^1.1.0", + "glob": "^7.1.6", + "is-glob": "^4.0.1", + "lodash": "^4.17.15", + "semver": "^6.3.0", + "tsutils": "^3.17.1" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "lodash": { + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "dev": true + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, "JSONStream": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", @@ -1553,6 +1677,12 @@ } } }, + "acorn-jsx": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.2.0.tgz", + "integrity": "sha512-HiUX/+K2YpkpJ+SzBffkM/AQ2YE03S0U1kjTLVpoJdhZMOWy8qvXVN9JdLqv2QsaQ6MPYQIuNmwD8zOiYUofLQ==", + "dev": true + }, "acorn-walk": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-6.2.0.tgz", @@ -1625,10 +1755,13 @@ "dev": true }, "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } }, "ansi-wrap": { "version": "0.1.0", @@ -1835,6 +1968,12 @@ "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", "dev": true }, + "ast-metadata-inferer": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ast-metadata-inferer/-/ast-metadata-inferer-0.1.1.tgz", + "integrity": "sha512-hc9w8Qrgg9Lf9iFcZVhNjUnhrd2BBpTlyCnegPVvCe6O0yMrF57a6Cmh7k+xUsfUOMh9wajOL5AsGOBNEyTCcw==", + "dev": true + }, "astral-regex": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", @@ -1892,17 +2031,6 @@ "integrity": "sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug==", "dev": true }, - "babel-code-frame": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", - "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", - "dev": true, - "requires": { - "chalk": "^1.1.3", - "esutils": "^2.0.2", - "js-tokens": "^3.0.2" - } - }, "babel-jest": { "version": "25.4.0", "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-25.4.0.tgz", @@ -2181,6 +2309,18 @@ } } }, + "browserslist": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.12.0.tgz", + "integrity": "sha512-UH2GkcEDSI0k/lRkuDSzFl9ZZ87skSy9w2XAn1MsZnL+4c4rqbBd3e82UWHbYDpztABrPBhZsTEeuxVfHppqDg==", + "dev": true, + "requires": { + "caniuse-lite": "^1.0.30001043", + "electron-to-chromium": "^1.3.413", + "node-releases": "^1.1.53", + "pkg-up": "^2.0.0" + } + }, "bs-logger": { "version": "0.2.6", "resolved": "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz", @@ -2211,12 +2351,6 @@ "integrity": "sha512-c5mRlguI/Pe2dSZmpER62rSCu0ryKmWddzRYsuXc50U2/g8jMOulc31VZMa4mYx31U5xsmSOpDCgH88Vl9cDGQ==", "dev": true }, - "builtin-modules": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", - "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", - "dev": true - }, "cache-base": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", @@ -2259,6 +2393,18 @@ } } }, + "caniuse-db": { + "version": "1.0.30001051", + "resolved": "https://registry.npmjs.org/caniuse-db/-/caniuse-db-1.0.30001051.tgz", + "integrity": "sha512-QSzF+LZ6ZHXsSIfIbs6HMPWrrjRMlt20xgGfb/rAnLDaqCH7iDBIbIWeyk8Hk7qdfmye/tpPFzfr0lV2LvzmCg==", + "dev": true + }, + "caniuse-lite": { + "version": "1.0.30001051", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001051.tgz", + "integrity": "sha512-sw8UUnTlRevawTMZKN7vpfwSjCBVoiMPlYd8oT2VwNylyPCBdMAUmLGUApnYYTtIm5JXsQegUAY7GPHqgfDzjw==", + "dev": true + }, "capture-exit": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/capture-exit/-/capture-exit-2.0.0.tgz", @@ -2275,18 +2421,22 @@ "dev": true }, "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", "dev": true, "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" } }, + "chardet": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", + "dev": true + }, "chokidar": { "version": "2.1.6", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.6.tgz", @@ -2353,6 +2503,21 @@ } } }, + "cli-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "dev": true, + "requires": { + "restore-cursor": "^3.1.0" + } + }, + "cli-width": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.1.tgz", + "integrity": "sha512-GRMWDxpOB6Dgk2E5Uo+3eEBvtOOlimMmpbFiKuLFnQzYDavtLFY3K5ona41jgN/WdRZtG7utuVSVTL4HbZHGkw==", + "dev": true + }, "clone": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", @@ -2483,12 +2648,6 @@ "delayed-stream": "~1.0.0" } }, - "commander": { - "version": "2.15.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", - "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", - "dev": true - }, "compare-func": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/compare-func/-/compare-func-1.3.2.tgz", @@ -3240,12 +3399,6 @@ "integrity": "sha1-9B8cEL5LAOh7XxPaaAdZ8sW/0+I=", "dev": true }, - "diff": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", - "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", - "dev": true - }, "diff-sequences": { "version": "25.2.6", "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-25.2.6.tgz", @@ -3269,6 +3422,15 @@ } } }, + "doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + }, "domexception": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/domexception/-/domexception-1.0.1.tgz", @@ -3366,6 +3528,18 @@ "integrity": "sha512-gzao+mxnYDzIysXKMQi/+M1mjy/rjestjg6OPoYTtI+3Izp23oiGZitsl9lPDPiTGXbcSIk1iJWhliSaglxnUg==", "dev": true }, + "electron-to-chromium": { + "version": "1.3.428", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.428.tgz", + "integrity": "sha512-u3+5jEfgLKq/hGO96YfAoOAM1tgFnRDTCD5mLuev44tttcXix+INtVegAkmGzUcfDsnzkPt51XXurXZLLwXt0w==", + "dev": true + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, "end-of-stream": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", @@ -3440,6 +3614,265 @@ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, + "eslint": { + "version": "6.8.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.8.0.tgz", + "integrity": "sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "ajv": "^6.10.0", + "chalk": "^2.1.0", + "cross-spawn": "^6.0.5", + "debug": "^4.0.1", + "doctrine": "^3.0.0", + "eslint-scope": "^5.0.0", + "eslint-utils": "^1.4.3", + "eslint-visitor-keys": "^1.1.0", + "espree": "^6.1.2", + "esquery": "^1.0.1", + "esutils": "^2.0.2", + "file-entry-cache": "^5.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^5.0.0", + "globals": "^12.1.0", + "ignore": "^4.0.6", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "inquirer": "^7.0.0", + "is-glob": "^4.0.0", + "js-yaml": "^3.13.1", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.3.0", + "lodash": "^4.17.14", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", + "natural-compare": "^1.4.0", + "optionator": "^0.8.3", + "progress": "^2.0.0", + "regexpp": "^2.0.1", + "semver": "^6.1.2", + "strip-ansi": "^5.2.0", + "strip-json-comments": "^3.0.1", + "table": "^5.2.3", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "eslint-utils": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.3.tgz", + "integrity": "sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + } + }, + "glob-parent": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", + "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "globals": { + "version": "12.4.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", + "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==", + "dev": true, + "requires": { + "type-fest": "^0.8.1" + } + }, + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true + }, + "is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "optionator": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", + "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", + "dev": true, + "requires": { + "deep-is": "~0.1.3", + "fast-levenshtein": "~2.0.6", + "levn": "~0.3.0", + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2", + "word-wrap": "~1.2.3" + } + }, + "regexpp": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz", + "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==", + "dev": true + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + } + } + }, + "eslint-plugin-compat": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-compat/-/eslint-plugin-compat-3.5.1.tgz", + "integrity": "sha512-dhfW12vZxxKLEVhrPoblmEopgwpYU2Sd4GdXj5OSfbQ+as9+1aY+S5pqnJYJvXXNWFFJ6aspLkCyk4NMQ/pgtA==", + "dev": true, + "requires": { + "@babel/runtime": "^7.7.7", + "ast-metadata-inferer": "^0.1.1", + "browserslist": "^4.8.2", + "caniuse-db": "^1.0.30001017", + "lodash.memoize": "4.1.2", + "mdn-browser-compat-data": "^1.0.3", + "semver": "^6.3.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "eslint-plugin-jest": { + "version": "23.8.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-23.8.2.tgz", + "integrity": "sha512-xwbnvOsotSV27MtAe7s8uGWOori0nUsrXh2f1EnpmXua8sDfY6VZhHAhHg2sqK7HBNycRQExF074XSZ7DvfoFg==", + "dev": true, + "requires": { + "@typescript-eslint/experimental-utils": "^2.5.0" + } + }, + "eslint-scope": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.0.0.tgz", + "integrity": "sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw==", + "dev": true, + "requires": { + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + } + }, + "eslint-utils": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.0.0.tgz", + "integrity": "sha512-0HCPuJv+7Wv1bACm8y5/ECVfYdfsAm9xmVb7saeFlxjPYALefjhbYoCkBjPdPzGH8wWyTpAez82Fh3VKYEZ8OA==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + } + }, + "eslint-visitor-keys": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz", + "integrity": "sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A==", + "dev": true + }, + "espree": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-6.2.1.tgz", + "integrity": "sha512-ysCxRQY3WaXJz9tdbWOwuWr5Y/XrPTGX9Kiz3yoUXwW0VZ4w30HTkQLaGx/+ttFjF8i+ACbArnB4ce68a9m5hw==", + "dev": true, + "requires": { + "acorn": "^7.1.1", + "acorn-jsx": "^5.2.0", + "eslint-visitor-keys": "^1.1.0" + }, + "dependencies": { + "acorn": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz", + "integrity": "sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==", + "dev": true + } + } + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "esquery": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.3.1.tgz", + "integrity": "sha512-olpvt9QG0vniUBZspVRN6lwB7hOZoTRtT+jzR+tS4ffYx2mzbw+z0XCOk44aaLYKApNX5nMm+E+P6o25ip/DHQ==", + "dev": true, + "requires": { + "estraverse": "^5.1.0" + }, + "dependencies": { + "estraverse": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.1.0.tgz", + "integrity": "sha512-FyohXK+R0vE+y1nHLoBM7ZTyqRpqAlhdZHCWIWEviFLiGB8b04H6bQs8G+XTthacvT8VuwvteiP7RJSxMs8UEw==", + "dev": true + } + } + }, + "esrecurse": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", + "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", + "dev": true, + "requires": { + "estraverse": "^4.1.0" + } + }, + "estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true + }, "estree-walker": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz", @@ -3586,6 +4019,17 @@ } } }, + "external-editor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", + "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", + "dev": true, + "requires": { + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", + "tmp": "^0.0.33" + } + }, "extglob": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", @@ -3781,6 +4225,24 @@ "bser": "2.1.1" } }, + "figures": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", + "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5" + } + }, + "file-entry-cache": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz", + "integrity": "sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==", + "dev": true, + "requires": { + "flat-cache": "^2.0.1" + } + }, "fill-range": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", @@ -3856,6 +4318,23 @@ "integrity": "sha512-lNaHNVymajmk0OJMBn8fVUAU1BtDeKIqKoVhk4xAALB57aALg6b4W0MfJ/cUE0g9YBXy5XhSlPIpYIJ7HaY/3Q==", "dev": true }, + "flat-cache": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", + "integrity": "sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA==", + "dev": true, + "requires": { + "flatted": "^2.0.0", + "rimraf": "2.6.3", + "write": "1.0.3" + } + }, + "flatted": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz", + "integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==", + "dev": true + }, "flush-write-stream": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.0.3.tgz", @@ -4589,6 +5068,12 @@ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, + "functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, "gensync": { "version": "1.0.0-beta.1", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.1.tgz", @@ -5461,14 +5946,11 @@ "har-schema": "^2.0.0" } }, - "has-ansi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", - "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true }, "has-symbols": { "version": "1.0.0", @@ -5570,6 +6052,24 @@ "integrity": "sha512-vdqWBp7MyzdmHkkRWV5nY+PfGRbYbahfuvsBCh277tq+w9zyNi7h5CYJCK0kmzti9kU+O/cB7sE8HvKv6aXAKQ==", "dev": true }, + "import-fresh": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz", + "integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "dependencies": { + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true + } + } + }, "import-local": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.0.2.tgz", @@ -5614,6 +6114,117 @@ "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", "dev": true }, + "inquirer": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.1.0.tgz", + "integrity": "sha512-5fJMWEmikSYu0nv/flMc475MhGbB7TSPd/2IpFV4I4rMklboCH2rQjYY5kKiYGHqUF9gvaambupcJFFG9dvReg==", + "dev": true, + "requires": { + "ansi-escapes": "^4.2.1", + "chalk": "^3.0.0", + "cli-cursor": "^3.1.0", + "cli-width": "^2.0.0", + "external-editor": "^3.0.3", + "figures": "^3.0.0", + "lodash": "^4.17.15", + "mute-stream": "0.0.8", + "run-async": "^2.4.0", + "rxjs": "^6.5.3", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0", + "through": "^2.3.6" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true + }, + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "lodash": { + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "dev": true + }, + "string-width": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", + "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, "interpret": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.2.0.tgz", @@ -7956,28 +8567,14 @@ } } }, - "js-tokens": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", - "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", - "dev": true - }, "js-yaml": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz", - "integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==", + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", "dev": true, "requires": { "argparse": "^1.0.7", "esprima": "^4.0.0" - }, - "dependencies": { - "esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true - } } }, "jsbn": { @@ -8277,6 +8874,24 @@ } } }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + }, + "dependencies": { + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + } + } + }, "lodash": { "version": "4.17.14", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.14.tgz", @@ -8326,15 +8941,6 @@ "lodash._reinterpolate": "~3.0.0" } }, - "log-symbols": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-1.0.2.tgz", - "integrity": "sha1-N2/3tY6jCGoPCfrMdGF+ylAeGhg=", - "dev": true, - "requires": { - "chalk": "^1.0.0" - } - }, "lolex": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/lolex/-/lolex-5.1.2.tgz", @@ -8466,6 +9072,23 @@ } } }, + "mdn-browser-compat-data": { + "version": "1.0.19", + "resolved": "https://registry.npmjs.org/mdn-browser-compat-data/-/mdn-browser-compat-data-1.0.19.tgz", + "integrity": "sha512-S1i9iILAsFi/C17NADg2cBT6D6Xcd5Ub+GSMQa5ScLhuVyUrRKjCNmFEED9mQ2G/lrKtvU9SGUrpPpXB8SXhCg==", + "dev": true, + "requires": { + "extend": "3.0.2" + }, + "dependencies": { + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true + } + } + }, "memoizee": { "version": "0.4.12", "resolved": "https://registry.npmjs.org/memoizee/-/memoizee-0.4.12.tgz", @@ -8708,6 +9331,23 @@ } } }, + "mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + }, + "dependencies": { + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true + } + } + }, "modify-values": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/modify-values/-/modify-values-1.0.1.tgz", @@ -8726,6 +9366,12 @@ "integrity": "sha512-kDcwXR4PS7caBpuRYYBUz9iVixUk3anO3f5OYFiIPwK/20vCzKCHyKoulbiDY1S53zD2bxUpxN/IJ+TnXjfvxg==", "dev": true }, + "mute-stream": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", + "dev": true + }, "nan": { "version": "2.14.0", "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", @@ -8811,6 +9457,12 @@ } } }, + "node-releases": { + "version": "1.1.54", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.54.tgz", + "integrity": "sha512-tLzytKpgwKQr37yw9CEODjNM9lnmsNxzlv575GzOZ16AgMvPcJis/DgrJX4UEV1KIYoXk6XoVfY6YaMOPJESAQ==", + "dev": true + }, "normalize-package-data": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", @@ -9123,6 +9775,32 @@ "p-try": "^2.0.0" } }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "requires": { + "p-limit": "^1.1.0" + }, + "dependencies": { + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "requires": { + "p-try": "^1.0.0" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "dev": true + } + } + }, "p-map": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/p-map/-/p-map-2.1.0.tgz", @@ -9135,6 +9813,15 @@ "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", "dev": true }, + "parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "requires": { + "callsites": "^3.0.0" + } + }, "parse-filepath": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/parse-filepath/-/parse-filepath-1.0.2.tgz", @@ -9345,6 +10032,26 @@ } } }, + "pkg-up": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pkg-up/-/pkg-up-2.0.0.tgz", + "integrity": "sha1-yBmscoBZpGHKscOImivjxJoATX8=", + "dev": true, + "requires": { + "find-up": "^2.1.0" + }, + "dependencies": { + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + } + } + }, "pn": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/pn/-/pn-1.1.0.tgz", @@ -9420,6 +10127,12 @@ "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", "dev": true }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true + }, "prompts": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.3.2.tgz", @@ -9609,6 +10322,12 @@ "strip-indent": "^2.0.0" } }, + "regenerator-runtime": { + "version": "0.13.5", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.5.tgz", + "integrity": "sha512-ZS5w8CpKFinUzOwW3c83oPeVXoNsrLsaCoLtJvAClH135j/R77RuymhiSErhm2lKcwSCIpmvIWSbDkIfAqKQlA==", + "dev": true + }, "regex-not": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", @@ -9619,6 +10338,12 @@ "safe-regex": "^1.1.0" } }, + "regexpp": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz", + "integrity": "sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==", + "dev": true + }, "remove-bom-buffer": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/remove-bom-buffer/-/remove-bom-buffer-3.0.0.tgz", @@ -9874,6 +10599,16 @@ "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", "dev": true }, + "restore-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "dev": true, + "requires": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + } + }, "ret": { "version": "0.1.15", "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", @@ -10089,12 +10824,30 @@ "integrity": "sha512-nfMOlASu9OnRJo1mbEk2cz0D56a1MBNrJ7orjRZQG10XDyuvwksKbuXNp6qa+kbn839HwjwhBzhFmdsaEAfauA==", "dev": true }, + "run-async": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.0.tgz", + "integrity": "sha512-xJTbh/d7Lm7SBhc1tNvTpeCHaEzoyxPrqNlvSdMfBTYwaY++UJFyXUOxAtsRUXjlqOfj8luNaR9vjCh4KeV+pg==", + "dev": true, + "requires": { + "is-promise": "^2.1.0" + } + }, "run-parallel": { "version": "1.1.9", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.1.9.tgz", "integrity": "sha512-DEqnSRTDw/Tc3FXf49zedI638Z9onwUotBMiUFKmrO2sdFKIbXamXGQ3Axd4qgphxKB4kw/qP1w5kTxnfU1B9Q==", "dev": true }, + "rxjs": { + "version": "6.5.5", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.5.tgz", + "integrity": "sha512-WfQI+1gohdf0Dai/Bbmk5L5ItH5tYqm3ki2c5GdWhKjalzjg93N3avFjVStyZZz+A2Em+ZxKH5bNghw9UeylGQ==", + "dev": true, + "requires": { + "tslib": "^1.9.0" + } + }, "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -10268,6 +11021,25 @@ "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true }, + "slice-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz", + "integrity": "sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.0", + "astral-regex": "^1.0.0", + "is-fullwidth-code-point": "^2.0.0" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + } + } + }, "snapdragon": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", @@ -10643,12 +11415,21 @@ "integrity": "sha1-XvjbKV0B5u1sv3qrlpmNeCJSe2g=", "dev": true }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "strip-json-comments": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.0.tgz", + "integrity": "sha512-e6/d0eBu7gHtdCqFt0xJr642LdToM5/cN4Qb9DbHjVx1CP5RyeM+zH7pbecEmDv/lBqb0QH+6Uqq75rxFPkM0w==", "dev": true }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, "supports-hyperlinks": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-2.1.0.tgz", @@ -10692,6 +11473,58 @@ "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", "dev": true }, + "table": { + "version": "5.4.6", + "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz", + "integrity": "sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==", + "dev": true, + "requires": { + "ajv": "^6.10.2", + "lodash": "^4.17.14", + "slice-ansi": "^2.1.0", + "string-width": "^3.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + } + } + }, "tempfile": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/tempfile/-/tempfile-1.1.1.tgz", @@ -10860,6 +11693,15 @@ "next-tick": "1" } }, + "tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "requires": { + "os-tmpdir": "~1.0.2" + } + }, "tmpl": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz", @@ -11083,135 +11925,10 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.1.tgz", "integrity": "sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA==" }, - "tslint": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.11.0.tgz", - "integrity": "sha1-mPMMAurjzecAYgHkwzywi0hYHu0=", - "dev": true, - "requires": { - "babel-code-frame": "^6.22.0", - "builtin-modules": "^1.1.1", - "chalk": "^2.3.0", - "commander": "^2.12.1", - "diff": "^3.2.0", - "glob": "^7.1.1", - "js-yaml": "^3.7.0", - "minimatch": "^3.0.4", - "resolve": "^1.3.2", - "semver": "^5.3.0", - "tslib": "^1.8.0", - "tsutils": "^2.27.2" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", - "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, - "semver": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", - "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==", - "dev": true - }, - "supports-color": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", - "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "tslint-stylish": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/tslint-stylish/-/tslint-stylish-2.1.0.tgz", - "integrity": "sha1-jNo8OMnKtU57It989CuO8RXc2V8=", - "dev": true, - "requires": { - "chalk": "^1.1.1", - "lodash": "^3.10.1", - "log-symbols": "^1.0.2", - "text-table": "^0.2.0", - "tslint": "^2.5.0" - }, - "dependencies": { - "findup-sync": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.2.1.tgz", - "integrity": "sha1-4KkKRQB1xJRm7lE3MgV1FLgeh4w=", - "dev": true, - "requires": { - "glob": "~4.3.0" - } - }, - "glob": { - "version": "4.3.5", - "resolved": "https://registry.npmjs.org/glob/-/glob-4.3.5.tgz", - "integrity": "sha1-gPuwjKVA8jiszl0R0em8QedRc9M=", - "dev": true, - "requires": { - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^2.0.1", - "once": "^1.3.0" - } - }, - "lodash": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", - "integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=", - "dev": true - }, - "minimatch": { - "version": "2.0.10", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.10.tgz", - "integrity": "sha1-jQh8OcazjAAbl/ynzm0OHoCvusc=", - "dev": true, - "requires": { - "brace-expansion": "^1.0.0" - } - }, - "tslint": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-2.5.1.tgz", - "integrity": "sha1-veTJnpfNXRxvuzAz9kt9iX/UGpI=", - "dev": true, - "requires": { - "findup-sync": "~0.2.1", - "optimist": "~0.6.0", - "underscore.string": "~3.1.1" - } - } - } - }, "tsutils": { - "version": "2.28.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.28.0.tgz", - "integrity": "sha512-bh5nAtW0tuhvOJnx1GLRn5ScraRLICGyJV5wJhtRWOLsxW70Kk5tZtpK3O/hW6LDnqKS9mlUMPZj9fEMJ0gxqA==", + "version": "3.17.1", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.17.1.tgz", + "integrity": "sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g==", "dev": true, "requires": { "tslib": "^1.8.1" @@ -11280,12 +11997,6 @@ "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=", "dev": true }, - "underscore.string": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-3.1.1.tgz", - "integrity": "sha1-DN1rytDARv12Y9MF2KeFtdoQ8zU=", - "dev": true - }, "undertaker": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/undertaker/-/undertaker-1.2.1.tgz", @@ -11451,6 +12162,12 @@ "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", "dev": true }, + "v8-compile-cache": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz", + "integrity": "sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g==", + "dev": true + }, "v8-to-istanbul": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-4.1.3.tgz", @@ -11778,6 +12495,12 @@ "integrity": "sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8=", "dev": true }, + "word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true + }, "wordwrap": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", @@ -11800,6 +12523,15 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, + "write": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/write/-/write-1.0.3.tgz", + "integrity": "sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig==", + "dev": true, + "requires": { + "mkdirp": "^0.5.1" + } + }, "write-file-atomic": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", diff --git a/package.json b/package.json index 6912cf2c57..b952066297 100644 --- a/package.json +++ b/package.json @@ -44,10 +44,15 @@ "@types/node": "^12.7.1", "@types/rollup-plugin-json": "^3.0.2", "@types/rollup-plugin-sourcemaps": "^0.4.2", + "@typescript-eslint/eslint-plugin": "^2.29.0", + "@typescript-eslint/parser": "^2.29.0", "conventional-changelog-angular": "^5.0.3", "conventional-changelog-cli": "^2.0.21", "del": "^5.0.0", "es6-shim": "^0.35.3", + "eslint": "^6.8.0", + "eslint-plugin-compat": "^3.5.1", + "eslint-plugin-jest": "^23.8.2", "gulp": "^4.0.2", "gulp-conventional-changelog": "^2.0.19", "gulp-replace": "^1.0.0", @@ -68,14 +73,14 @@ "ts-jest": "^25.4.0", "ts-node": "^8.8.1", "tslib": "^1.11.1", - "tslint": "^5.11.0", - "tslint-stylish": "^2.1.0", "typescript": "^3.5.3", "webpack-config-utils": "^2.3.1" }, "scripts": { "build": "gulp package", "test": "gulp tests", + "lint": "gulp eslint", "changelog": "gulp changelog" - } + }, + "browserslist": ["> 5%"] } diff --git a/src/.eslintrc.js b/src/.eslintrc.js new file mode 100644 index 0000000000..47c22e9d23 --- /dev/null +++ b/src/.eslintrc.js @@ -0,0 +1,8 @@ +module.exports = { + env: { + browser: true, + }, + extends: [ + "plugin:compat/recommended" + ] +}; diff --git a/src/container.ts b/src/container.ts index cc18963daf..c2e2e5f554 100644 --- a/src/container.ts +++ b/src/container.ts @@ -21,7 +21,7 @@ export interface UseContainerOptions { * container simply creates a new instance of the given class. */ const defaultContainer: { get(someClass: { new (...args: any[]): T }|Function): T } = new (class { - private instances: { type: Function, object: any }[] = []; + private instances: { type: Function; object: any }[] = []; get(someClass: { new (...args: any[]): T }): T { let instance = this.instances.find(instance => instance.type === someClass); if (!instance) { @@ -39,7 +39,7 @@ let userContainerOptions: UseContainerOptions; /** * Sets container to be used by this library. */ -export function useContainer(iocContainer: { get(someClass: any): any }, options?: UseContainerOptions) { +export function useContainer(iocContainer: { get(someClass: any): any }, options?: UseContainerOptions): void { userContainer = iocContainer; userContainerOptions = options; } diff --git a/src/decorator/array/ArrayContains.ts b/src/decorator/array/ArrayContains.ts index 9f7616c71a..7652aaf112 100644 --- a/src/decorator/array/ArrayContains.ts +++ b/src/decorator/array/ArrayContains.ts @@ -7,7 +7,7 @@ export const ARRAY_CONTAINS = "arrayContains"; * Checks if array contains all values from the given array of values. * If null or undefined is given then this function returns false. */ -export function arrayContains(array: unknown, values: any[]) { +export function arrayContains(array: unknown, values: any[]): boolean { if (!(array instanceof Array)) return false; @@ -24,7 +24,7 @@ export function ArrayContains(values: any[], validationOptions?: ValidationOptio name: ARRAY_CONTAINS, constraints: [values], validator: { - validate: (value, args) => arrayContains(value, args.constraints[0]), + validate: (value, args): boolean => arrayContains(value, args.constraints[0]), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must contain $constraint1 values", validationOptions diff --git a/src/decorator/array/ArrayMaxSize.ts b/src/decorator/array/ArrayMaxSize.ts index bc55330927..5779a2bebc 100644 --- a/src/decorator/array/ArrayMaxSize.ts +++ b/src/decorator/array/ArrayMaxSize.ts @@ -7,7 +7,7 @@ export const ARRAY_MAX_SIZE = "arrayMaxSize"; * Checks if array's length is as maximal this number. * If null or undefined is given then this function returns false. */ -export function arrayMaxSize(array: unknown, max: number) { +export function arrayMaxSize(array: unknown, max: number): boolean { return array instanceof Array && array.length <= max; } @@ -21,7 +21,7 @@ export function ArrayMaxSize(max: number, validationOptions?: ValidationOptions) name: ARRAY_MAX_SIZE, constraints: [max], validator: { - validate: (value, args) => arrayMaxSize(value, args.constraints[0]), + validate: (value, args): boolean => arrayMaxSize(value, args.constraints[0]), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must contain not more than $constraint1 elements", validationOptions diff --git a/src/decorator/array/ArrayMinSize.ts b/src/decorator/array/ArrayMinSize.ts index 759f43253f..523820e666 100644 --- a/src/decorator/array/ArrayMinSize.ts +++ b/src/decorator/array/ArrayMinSize.ts @@ -7,7 +7,7 @@ export const ARRAY_MIN_SIZE = "arrayMinSize"; * Checks if array's length is as minimal this number. * If null or undefined is given then this function returns false. */ -export function arrayMinSize(array: unknown, min: number) { +export function arrayMinSize(array: unknown, min: number): boolean { return array instanceof Array && array.length >= min; } @@ -21,7 +21,7 @@ export function ArrayMinSize(min: number, validationOptions?: ValidationOptions) name: ARRAY_MIN_SIZE, constraints: [min], validator: { - validate: (value, args) => arrayMinSize(value, args.constraints[0]), + validate: (value, args): boolean => arrayMinSize(value, args.constraints[0]), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must contain at least $constraint1 elements", validationOptions diff --git a/src/decorator/array/ArrayNotContains.ts b/src/decorator/array/ArrayNotContains.ts index aa0175290b..624580a264 100644 --- a/src/decorator/array/ArrayNotContains.ts +++ b/src/decorator/array/ArrayNotContains.ts @@ -7,7 +7,7 @@ export const ARRAY_NOT_CONTAINS = "arrayNotContains"; * Checks if array does not contain any of the given values. * If null or undefined is given then this function returns false. */ -export function arrayNotContains(array: unknown, values: any[]) { +export function arrayNotContains(array: unknown, values: any[]): boolean { if (!(array instanceof Array)) return false; @@ -24,7 +24,7 @@ export function ArrayNotContains(values: any[], validationOptions?: ValidationOp name: ARRAY_NOT_CONTAINS, constraints: [values], validator: { - validate: (value, args) => arrayNotContains(value, args.constraints[0]), + validate: (value, args): boolean => arrayNotContains(value, args.constraints[0]), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property should not contain $constraint1 values", validationOptions diff --git a/src/decorator/array/ArrayNotEmpty.ts b/src/decorator/array/ArrayNotEmpty.ts index 4804940eb7..0e0ef25565 100644 --- a/src/decorator/array/ArrayNotEmpty.ts +++ b/src/decorator/array/ArrayNotEmpty.ts @@ -7,7 +7,7 @@ export const ARRAY_NOT_EMPTY = "arrayNotEmpty"; * Checks if given array is not empty. * If null or undefined is given then this function returns false. */ -export function arrayNotEmpty(array: unknown) { +export function arrayNotEmpty(array: unknown): boolean { return array instanceof Array && array.length > 0; } @@ -20,7 +20,7 @@ export function ArrayNotEmpty(validationOptions?: ValidationOptions): PropertyDe { name: ARRAY_NOT_EMPTY, validator: { - validate: (value, args) => arrayNotEmpty(value), + validate: (value, args): boolean => arrayNotEmpty(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property should not be empty", validationOptions diff --git a/src/decorator/array/ArrayUnique.ts b/src/decorator/array/ArrayUnique.ts index 24b8ec7557..e0fb6766c7 100644 --- a/src/decorator/array/ArrayUnique.ts +++ b/src/decorator/array/ArrayUnique.ts @@ -7,7 +7,7 @@ export const ARRAY_UNIQUE = "arrayUnique"; * Checks if all array's values are unique. Comparison for objects is reference-based. * If null or undefined is given then this function returns false. */ -export function arrayUnique(array: unknown) { +export function arrayUnique(array: unknown): boolean { if (!(array instanceof Array)) return false; @@ -24,7 +24,7 @@ export function ArrayUnique(validationOptions?: ValidationOptions): PropertyDeco { name: ARRAY_UNIQUE, validator: { - validate: (value, args) => arrayUnique(value), + validate: (value, args): boolean => arrayUnique(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "All $property's elements must be unique", validationOptions diff --git a/src/decorator/common/Allow.ts b/src/decorator/common/Allow.ts index 5a35597f36..fe5795f6d2 100644 --- a/src/decorator/common/Allow.ts +++ b/src/decorator/common/Allow.ts @@ -8,7 +8,7 @@ import { getMetadataStorage } from "../../metadata/MetadataStorage"; * If object has both allowed and not allowed properties a validation error will be thrown. */ export function Allow(validationOptions?: ValidationOptions): PropertyDecorator { - return function (object: Object, propertyName: string) { + return function (object: object, propertyName: string): void { const args: ValidationMetadataArgs = { type: ValidationTypes.WHITELIST, target: object.constructor, diff --git a/src/decorator/common/Equals.ts b/src/decorator/common/Equals.ts index a3563791d7..97ca520144 100644 --- a/src/decorator/common/Equals.ts +++ b/src/decorator/common/Equals.ts @@ -19,7 +19,7 @@ export function Equals(comparison: any, validationOptions?: ValidationOptions): name: EQUALS, constraints: [comparison], validator: { - validate: (value, args) => equals(value, args.constraints[0]), + validate: (value, args): boolean => equals(value, args.constraints[0]), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be equal to $constraint1", validationOptions diff --git a/src/decorator/common/IsDefined.ts b/src/decorator/common/IsDefined.ts index 63992ac6dd..7686cfc552 100644 --- a/src/decorator/common/IsDefined.ts +++ b/src/decorator/common/IsDefined.ts @@ -20,7 +20,7 @@ export function IsDefined(validationOptions?: ValidationOptions): PropertyDecora { name: IS_DEFINED, validator: { - validate: (value) => isDefined(value), + validate: (value): boolean => isDefined(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property should not be null or undefined", validationOptions diff --git a/src/decorator/common/IsEmpty.ts b/src/decorator/common/IsEmpty.ts index 10f977d7b4..ff6214e67d 100644 --- a/src/decorator/common/IsEmpty.ts +++ b/src/decorator/common/IsEmpty.ts @@ -18,7 +18,7 @@ export function IsEmpty(validationOptions?: ValidationOptions): PropertyDecorato { name: IS_EMPTY, validator: { - validate: (value, args) => isEmpty(value), + validate: (value, args): boolean => isEmpty(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be empty", validationOptions diff --git a/src/decorator/common/IsIn.ts b/src/decorator/common/IsIn.ts index 4bbd631118..a14bf1f088 100644 --- a/src/decorator/common/IsIn.ts +++ b/src/decorator/common/IsIn.ts @@ -19,7 +19,7 @@ export function IsIn(values: any[], validationOptions?: ValidationOptions): Prop name: IS_IN, constraints: [values], validator: { - validate: (value, args) => isIn(value, args.constraints[0]), + validate: (value, args): boolean => isIn(value, args.constraints[0]), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be one of the following values: $constraint1", validationOptions diff --git a/src/decorator/common/IsLatLong.ts b/src/decorator/common/IsLatLong.ts index 3eeba6c0c4..1e122e2023 100644 --- a/src/decorator/common/IsLatLong.ts +++ b/src/decorator/common/IsLatLong.ts @@ -19,7 +19,7 @@ export function IsLatLong(validationOptions?: ValidationOptions): PropertyDecora { name: IS_LATLONG, validator: { - validate: (value, args) => isLatLong(value), + validate: (value, args): boolean => isLatLong(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a latitude,longitude string", validationOptions diff --git a/src/decorator/common/IsLatitude.ts b/src/decorator/common/IsLatitude.ts index b2b3402d8f..773e9aab9d 100644 --- a/src/decorator/common/IsLatitude.ts +++ b/src/decorator/common/IsLatitude.ts @@ -19,7 +19,7 @@ export function IsLatitude(validationOptions?: ValidationOptions): PropertyDecor { name: IS_LATITUDE, validator: { - validate: (value, args) => isLatitude(value), + validate: (value, args): boolean => isLatitude(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a latitude string or number", validationOptions diff --git a/src/decorator/common/IsLongitude.ts b/src/decorator/common/IsLongitude.ts index 2340d853ac..4ca50e427e 100644 --- a/src/decorator/common/IsLongitude.ts +++ b/src/decorator/common/IsLongitude.ts @@ -19,7 +19,7 @@ export function IsLongitude(validationOptions?: ValidationOptions): PropertyDeco { name: IS_LONGITUDE, validator: { - validate: (value, args) => isLongitude(value), + validate: (value, args): boolean => isLongitude(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a longitude string or number", validationOptions diff --git a/src/decorator/common/IsNotEmpty.ts b/src/decorator/common/IsNotEmpty.ts index 9a6077a0d6..c269567b55 100644 --- a/src/decorator/common/IsNotEmpty.ts +++ b/src/decorator/common/IsNotEmpty.ts @@ -18,7 +18,7 @@ export function IsNotEmpty(validationOptions?: ValidationOptions): PropertyDecor { name: IS_NOT_EMPTY, validator: { - validate: (value, args) => isNotEmpty(value), + validate: (value, args): boolean => isNotEmpty(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property should not be empty", validationOptions diff --git a/src/decorator/common/IsNotIn.ts b/src/decorator/common/IsNotIn.ts index 255fb68e31..f4d8d94598 100644 --- a/src/decorator/common/IsNotIn.ts +++ b/src/decorator/common/IsNotIn.ts @@ -19,7 +19,7 @@ export function IsNotIn(values: any[], validationOptions?: ValidationOptions): P name: IS_NOT_IN, constraints: [values], validator: { - validate: (value, args) => isNotIn(value, args.constraints[0]), + validate: (value, args): boolean => isNotIn(value, args.constraints[0]), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property should not be one of the following values: $constraint1", validationOptions diff --git a/src/decorator/common/IsOptional.ts b/src/decorator/common/IsOptional.ts index 82fabdcd90..3560b37cf9 100644 --- a/src/decorator/common/IsOptional.ts +++ b/src/decorator/common/IsOptional.ts @@ -8,12 +8,12 @@ import { getMetadataStorage } from "../../metadata/MetadataStorage"; * Checks if value is missing and if so, ignores all validators. */ export function IsOptional(validationOptions?: ValidationOptions): PropertyDecorator { - return function (object: Object, propertyName: string) { + return function (object: object, propertyName: string): void { const args: ValidationMetadataArgs = { type: ValidationTypes.CONDITIONAL_VALIDATION, target: object.constructor, propertyName: propertyName, - constraints: [(object: any, value: any) => { + constraints: [(object: any, value: any): boolean => { return object[propertyName] !== null && object[propertyName] !== undefined; }], validationOptions: validationOptions diff --git a/src/decorator/common/NotEquals.ts b/src/decorator/common/NotEquals.ts index a1c252470c..266e0e9d59 100644 --- a/src/decorator/common/NotEquals.ts +++ b/src/decorator/common/NotEquals.ts @@ -19,7 +19,7 @@ export function NotEquals(comparison: any, validationOptions?: ValidationOptions name: NOT_EQUALS, constraints: [comparison], validator: { - validate: (value, args) => notEquals(value, args.constraints[0]), + validate: (value, args): boolean => notEquals(value, args.constraints[0]), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property should not be equal to $constraint1", validationOptions diff --git a/src/decorator/common/Validate.ts b/src/decorator/common/Validate.ts index 2de7ee2b57..1661e3ada2 100644 --- a/src/decorator/common/Validate.ts +++ b/src/decorator/common/Validate.ts @@ -8,9 +8,9 @@ import { ConstraintMetadata } from "../../metadata/ConstraintMetadata"; /** * Registers custom validator class. */ -export function ValidatorConstraint(options?: { name?: string, async?: boolean }) { - return function (target: Function) { - const isAsync = options && options.async ? true : false; +export function ValidatorConstraint(options?: { name?: string; async?: boolean }) { + return function (target: Function): void { + const isAsync = options && options.async; let name = options && options.name ? options.name : ""; if (!name) { name = (target as any).name; @@ -29,14 +29,14 @@ export function ValidatorConstraint(options?: { name?: string, async?: boolean } export function Validate(constraintClass: Function, validationOptions?: ValidationOptions): PropertyDecorator; export function Validate(constraintClass: Function, constraints?: any[], validationOptions?: ValidationOptions): PropertyDecorator; export function Validate(constraintClass: Function, constraintsOrValidationOptions?: any[] | ValidationOptions, maybeValidationOptions?: ValidationOptions): PropertyDecorator { - return function (object: Object, propertyName: string) { + return function (object: object, propertyName: string): void { const args: ValidationMetadataArgs = { type: ValidationTypes.CUSTOM_VALIDATION, target: object.constructor, propertyName: propertyName, constraintCls: constraintClass, - constraints: constraintsOrValidationOptions instanceof Array ? constraintsOrValidationOptions as any[] : undefined, - validationOptions: !(constraintsOrValidationOptions instanceof Array) ? constraintsOrValidationOptions as ValidationOptions : maybeValidationOptions + constraints: constraintsOrValidationOptions instanceof Array ? constraintsOrValidationOptions : undefined, + validationOptions: !(constraintsOrValidationOptions instanceof Array) ? constraintsOrValidationOptions : maybeValidationOptions }; getMetadataStorage().addValidationMetadata(new ValidationMetadata(args)); }; diff --git a/src/decorator/common/ValidateBy.ts b/src/decorator/common/ValidateBy.ts index 1d15a43adf..a0d6f66881 100644 --- a/src/decorator/common/ValidateBy.ts +++ b/src/decorator/common/ValidateBy.ts @@ -12,9 +12,8 @@ export interface ValidateByOptions { export function buildMessage( impl: (eachPrefix: string, args?: ValidationArguments) => string, - validationOptions?: ValidationOptions) - : (validationArguments?: ValidationArguments) => string { - return (validationArguments?: ValidationArguments) => { + validationOptions?: ValidationOptions): (validationArguments?: ValidationArguments) => string { + return (validationArguments?: ValidationArguments): string => { const eachPrefix = validationOptions && validationOptions.each ? "each value in " : ""; @@ -23,7 +22,7 @@ export function buildMessage( } export function ValidateBy(options: ValidateByOptions, validationOptions?: ValidationOptions): PropertyDecorator { - return function (object: Object, propertyName: string) { + return function (object: object, propertyName: string): void { registerDecorator({ name: options.name, target: object.constructor, diff --git a/src/decorator/common/ValidateIf.ts b/src/decorator/common/ValidateIf.ts index e1180f7f69..31bd721012 100644 --- a/src/decorator/common/ValidateIf.ts +++ b/src/decorator/common/ValidateIf.ts @@ -8,7 +8,7 @@ import { getMetadataStorage } from "../../metadata/MetadataStorage"; * Objects / object arrays marked with this decorator will also be validated. */ export function ValidateIf(condition: (object: any, value: any) => boolean, validationOptions?: ValidationOptions): PropertyDecorator { - return function (object: Object, propertyName: string) { + return function (object: object, propertyName: string): void { const args: ValidationMetadataArgs = { type: ValidationTypes.CONDITIONAL_VALIDATION, target: object.constructor, diff --git a/src/decorator/common/ValidateNested.ts b/src/decorator/common/ValidateNested.ts index 8ee0ac9c18..74bcfcc1b6 100644 --- a/src/decorator/common/ValidateNested.ts +++ b/src/decorator/common/ValidateNested.ts @@ -12,7 +12,7 @@ export function ValidateNested(validationOptions?: ValidationOptions): PropertyD const eachPrefix = opts.each ? "each value in " : ""; opts.message = opts.message || eachPrefix + "nested property $property must be either object or array"; - return function (object: Object, propertyName: string) { + return function (object: object, propertyName: string): void { const args: ValidationMetadataArgs = { type: ValidationTypes.NESTED_VALIDATION, target: object.constructor, diff --git a/src/decorator/common/ValidatePromise.ts b/src/decorator/common/ValidatePromise.ts index aeb90f4177..e08bdc7c49 100644 --- a/src/decorator/common/ValidatePromise.ts +++ b/src/decorator/common/ValidatePromise.ts @@ -8,7 +8,7 @@ import { getMetadataStorage } from "../../metadata/MetadataStorage"; * Resolve promise before validation */ export function ValidatePromise(validationOptions?: ValidationOptions): PropertyDecorator { - return function (object: Object, propertyName: string) { + return function (object: object, propertyName: string): void { const args: ValidationMetadataArgs = { type: ValidationTypes.PROMISE_VALIDATION, target: object.constructor, diff --git a/src/decorator/date/MaxDate.ts b/src/decorator/date/MaxDate.ts index 2f7e366cf6..24b5f19fee 100644 --- a/src/decorator/date/MaxDate.ts +++ b/src/decorator/date/MaxDate.ts @@ -19,7 +19,7 @@ export function MaxDate(date: Date, validationOptions?: ValidationOptions): Prop name: MAX_DATE, constraints: [date], validator: { - validate: (value, args) => maxDate(value, args.constraints[0]), + validate: (value, args): boolean => maxDate(value, args.constraints[0]), defaultMessage: buildMessage( (eachPrefix) => "maximal allowed date for " + eachPrefix + "$property is $constraint1", validationOptions diff --git a/src/decorator/date/MinDate.ts b/src/decorator/date/MinDate.ts index aa323b486d..ceeaa518c9 100644 --- a/src/decorator/date/MinDate.ts +++ b/src/decorator/date/MinDate.ts @@ -19,7 +19,7 @@ export function MinDate(date: Date, validationOptions?: ValidationOptions): Prop name: MIN_DATE, constraints: [date], validator: { - validate: (value, args) => minDate(value, args.constraints[0]), + validate: (value, args): boolean => minDate(value, args.constraints[0]), defaultMessage: buildMessage( (eachPrefix) => "minimal allowed date for " + eachPrefix + "$property is $constraint1", validationOptions diff --git a/src/decorator/number/IsDivisibleBy.ts b/src/decorator/number/IsDivisibleBy.ts index 7650177391..8d7f3abe3f 100644 --- a/src/decorator/number/IsDivisibleBy.ts +++ b/src/decorator/number/IsDivisibleBy.ts @@ -22,7 +22,7 @@ export function IsDivisibleBy(num: number, validationOptions?: ValidationOptions name: IS_DIVISIBLE_BY, constraints: [num], validator: { - validate: (value, args) => isDivisibleBy(value, args.constraints[0]), + validate: (value, args): boolean => isDivisibleBy(value, args.constraints[0]), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be divisible by $constraint1", validationOptions diff --git a/src/decorator/number/IsNegative.ts b/src/decorator/number/IsNegative.ts index 4db4ed1fdb..a3c9891d0d 100644 --- a/src/decorator/number/IsNegative.ts +++ b/src/decorator/number/IsNegative.ts @@ -18,7 +18,7 @@ export function IsNegative(validationOptions?: ValidationOptions): PropertyDecor { name: IS_NEGATIVE, validator: { - validate: (value, args) => isNegative(value), + validate: (value, args): boolean => isNegative(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a negative number", validationOptions diff --git a/src/decorator/number/IsPositive.ts b/src/decorator/number/IsPositive.ts index d41a55316f..ccf679bbe7 100644 --- a/src/decorator/number/IsPositive.ts +++ b/src/decorator/number/IsPositive.ts @@ -18,7 +18,7 @@ export function IsPositive(validationOptions?: ValidationOptions): PropertyDecor { name: IS_POSITIVE, validator: { - validate: (value, args) => isPositive(value), + validate: (value, args): boolean => isPositive(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a positive number", validationOptions diff --git a/src/decorator/number/Max.ts b/src/decorator/number/Max.ts index 311e20c275..792efdd277 100644 --- a/src/decorator/number/Max.ts +++ b/src/decorator/number/Max.ts @@ -19,7 +19,7 @@ export function Max(maxValue: number, validationOptions?: ValidationOptions): Pr name: MAX, constraints: [maxValue], validator: { - validate: (value, args) => max(value, args.constraints[0]), + validate: (value, args): boolean => max(value, args.constraints[0]), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must not be greater than $constraint1", validationOptions diff --git a/src/decorator/number/Min.ts b/src/decorator/number/Min.ts index ce3278b27c..88223aac9c 100644 --- a/src/decorator/number/Min.ts +++ b/src/decorator/number/Min.ts @@ -19,7 +19,7 @@ export function Min(minValue: number, validationOptions?: ValidationOptions): Pr name: MIN, constraints: [minValue], validator: { - validate: (value, args) => min(value, args.constraints[0]), + validate: (value, args): boolean => min(value, args.constraints[0]), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must not be less than $constraint1", validationOptions diff --git a/src/decorator/object/IsInstance.ts b/src/decorator/object/IsInstance.ts index 9627440473..d72b4f5287 100644 --- a/src/decorator/object/IsInstance.ts +++ b/src/decorator/object/IsInstance.ts @@ -6,7 +6,7 @@ export const IS_INSTANCE = "isInstance"; /** * Checks if the value is an instance of the specified object. */ -export function isInstance(object: unknown, targetTypeConstructor: new (...args: any[]) => any) { +export function isInstance(object: unknown, targetTypeConstructor: new (...args: any[]) => any): boolean { return targetTypeConstructor && typeof targetTypeConstructor === "function" && object instanceof targetTypeConstructor; @@ -21,7 +21,7 @@ export function IsInstance(targetType: new (...args: any[]) => any, validationOp name: IS_INSTANCE, constraints: [targetType], validator: { - validate: (value, args) => isInstance(value, args.constraints[0]), + validate: (value, args): boolean => isInstance(value, args.constraints[0]), defaultMessage: buildMessage( (eachPrefix, args) => { if (args.constraints[0]) { diff --git a/src/decorator/object/IsNotEmptyObject.ts b/src/decorator/object/IsNotEmptyObject.ts index 4085adcb38..b68addca48 100644 --- a/src/decorator/object/IsNotEmptyObject.ts +++ b/src/decorator/object/IsNotEmptyObject.ts @@ -30,7 +30,7 @@ export function IsNotEmptyObject(validationOptions?: ValidationOptions): Propert { name: IS_NOT_EMPTY_OBJECT, validator: { - validate: (value, args) => isNotEmptyObject(value), + validate: (value, args): boolean => isNotEmptyObject(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a non-empty object", validationOptions diff --git a/src/decorator/string/Contains.ts b/src/decorator/string/Contains.ts index db14394e67..4ad25ae52a 100644 --- a/src/decorator/string/Contains.ts +++ b/src/decorator/string/Contains.ts @@ -22,7 +22,7 @@ export function Contains(seed: string, validationOptions?: ValidationOptions): P name: CONTAINS, constraints: [seed], validator: { - validate: (value, args) => contains(value, args.constraints[0]), + validate: (value, args): boolean => contains(value, args.constraints[0]), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must contain a $constraint1 string", validationOptions diff --git a/src/decorator/string/IsAlpha.ts b/src/decorator/string/IsAlpha.ts index 4b1ce9a138..65c6e53ba7 100644 --- a/src/decorator/string/IsAlpha.ts +++ b/src/decorator/string/IsAlpha.ts @@ -22,7 +22,7 @@ export function IsAlpha(locale?: string, validationOptions?: ValidationOptions): name: IS_ALPHA, constraints: [locale], validator: { - validate: (value, args) => isAlpha(value, args.constraints[0]), + validate: (value, args): boolean => isAlpha(value, args.constraints[0]), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must contain only letters (a-zA-Z)", validationOptions diff --git a/src/decorator/string/IsAlphanumeric.ts b/src/decorator/string/IsAlphanumeric.ts index 8e3e40d7a0..69b2389aae 100644 --- a/src/decorator/string/IsAlphanumeric.ts +++ b/src/decorator/string/IsAlphanumeric.ts @@ -22,7 +22,7 @@ export function IsAlphanumeric(locale?: string, validationOptions?: ValidationOp name: IS_ALPHANUMERIC, constraints: [locale], validator: { - validate: (value, args) => isAlphanumeric(value, args.constraints[0]), + validate: (value, args): boolean => isAlphanumeric(value, args.constraints[0]), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must contain only letters and numbers", validationOptions diff --git a/src/decorator/string/IsAscii.ts b/src/decorator/string/IsAscii.ts index 682afeffda..4a3e0a06be 100644 --- a/src/decorator/string/IsAscii.ts +++ b/src/decorator/string/IsAscii.ts @@ -21,7 +21,7 @@ export function IsAscii(validationOptions?: ValidationOptions): PropertyDecorato { name: IS_ASCII, validator: { - validate: (value, args) => isAscii(value), + validate: (value, args): boolean => isAscii(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must contain only ASCII characters", validationOptions diff --git a/src/decorator/string/IsBIC.ts b/src/decorator/string/IsBIC.ts index 0b05bb54a5..fcc9bbf211 100644 --- a/src/decorator/string/IsBIC.ts +++ b/src/decorator/string/IsBIC.ts @@ -21,7 +21,7 @@ export function IsBIC(validationOptions?: ValidationOptions): PropertyDecorator { name: IS_BIC, validator: { - validate: (value, args) => isBIC(value), + validate: (value, args): boolean => isBIC(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a BIC or SWIFT code", validationOptions diff --git a/src/decorator/string/IsBase32.ts b/src/decorator/string/IsBase32.ts index fb46d3015b..29bf573116 100644 --- a/src/decorator/string/IsBase32.ts +++ b/src/decorator/string/IsBase32.ts @@ -21,7 +21,7 @@ export function IsBase32(validationOptions?: ValidationOptions): PropertyDecorat { name: IS_BASE32, validator: { - validate: (value, args) => isBase32(value), + validate: (value, args): boolean => isBase32(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be base32 encoded", validationOptions diff --git a/src/decorator/string/IsBase64.ts b/src/decorator/string/IsBase64.ts index ba2a6ae6e3..6481d14d9d 100644 --- a/src/decorator/string/IsBase64.ts +++ b/src/decorator/string/IsBase64.ts @@ -21,7 +21,7 @@ export function IsBase64(validationOptions?: ValidationOptions): PropertyDecorat { name: IS_BASE64, validator: { - validate: (value, args) => isBase64(value), + validate: (value, args): boolean => isBase64(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be base64 encoded", validationOptions diff --git a/src/decorator/string/IsBooleanString.ts b/src/decorator/string/IsBooleanString.ts index fd2ab0b85b..ba9fd4156b 100644 --- a/src/decorator/string/IsBooleanString.ts +++ b/src/decorator/string/IsBooleanString.ts @@ -21,7 +21,7 @@ export function IsBooleanString(validationOptions?: ValidationOptions): Property { name: IS_BOOLEAN_STRING, validator: { - validate: (value, args) => isBooleanString(value), + validate: (value, args): boolean => isBooleanString(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a boolean string", validationOptions diff --git a/src/decorator/string/IsBtcAddress.ts b/src/decorator/string/IsBtcAddress.ts index d886bb6d89..19bf3c1dff 100644 --- a/src/decorator/string/IsBtcAddress.ts +++ b/src/decorator/string/IsBtcAddress.ts @@ -21,7 +21,7 @@ export function IsBtcAddress(validationOptions?: ValidationOptions): PropertyDec { name: IS_BTC_ADDRESS, validator: { - validate: (value, args) => isBtcAddress(value), + validate: (value, args): boolean => isBtcAddress(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a BTC address", validationOptions diff --git a/src/decorator/string/IsByteLength.ts b/src/decorator/string/IsByteLength.ts index cce52e748c..e30f399e7d 100644 --- a/src/decorator/string/IsByteLength.ts +++ b/src/decorator/string/IsByteLength.ts @@ -22,7 +22,7 @@ export function IsByteLength(min: number, max?: number, validationOptions?: Vali name: IS_BYTE_LENGTH, constraints: [min, max], validator: { - validate: (value, args) => isByteLength(value, args.constraints[0], args.constraints[1]), + validate: (value, args): boolean => isByteLength(value, args.constraints[0], args.constraints[1]), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property's byte length must fall into ($constraint1, $constraint2) range", validationOptions diff --git a/src/decorator/string/IsCreditCard.ts b/src/decorator/string/IsCreditCard.ts index 693fae9661..b0a69bef94 100644 --- a/src/decorator/string/IsCreditCard.ts +++ b/src/decorator/string/IsCreditCard.ts @@ -21,7 +21,7 @@ export function IsCreditCard(validationOptions?: ValidationOptions): PropertyDec { name: IS_CREDIT_CARD, validator: { - validate: (value, args) => isCreditCard(value), + validate: (value, args): boolean => isCreditCard(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a credit card", validationOptions diff --git a/src/decorator/string/IsCurrency.ts b/src/decorator/string/IsCurrency.ts index 7561228dee..941ca321cb 100644 --- a/src/decorator/string/IsCurrency.ts +++ b/src/decorator/string/IsCurrency.ts @@ -22,7 +22,7 @@ export function IsCurrency(options?: ValidatorJS.IsCurrencyOptions, validationOp name: IS_CURRENCY, constraints: [options], validator: { - validate: (value, args) => isCurrency(value, args.constraints[0]), + validate: (value, args): boolean => isCurrency(value, args.constraints[0]), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a currency", validationOptions diff --git a/src/decorator/string/IsDataURI.ts b/src/decorator/string/IsDataURI.ts index 6ac0b879e4..10a2f9970a 100644 --- a/src/decorator/string/IsDataURI.ts +++ b/src/decorator/string/IsDataURI.ts @@ -21,7 +21,7 @@ export function IsDataURI(validationOptions?: ValidationOptions): PropertyDecora { name: IS_DATA_URI, validator: { - validate: (value, args) => isDataURI(value), + validate: (value, args): boolean => isDataURI(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a data uri format", validationOptions diff --git a/src/decorator/string/IsDateString.ts b/src/decorator/string/IsDateString.ts index c8cab8c3d8..b9159fe70e 100644 --- a/src/decorator/string/IsDateString.ts +++ b/src/decorator/string/IsDateString.ts @@ -7,7 +7,7 @@ export const IS_DATE_STRING = "isDateString"; * Checks if a given value is a ISOString date. */ export function isDateString(value: unknown): boolean { - const regex = /^\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[\+\-][0-2]\d(?:\:[0-5]\d)?)?$/g; + const regex = /^\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-][0-2]\d(?::[0-5]\d)?)?$/g; return typeof value === "string" && regex.test(value); } @@ -19,7 +19,7 @@ export function IsDateString(validationOptions?: ValidationOptions): PropertyDec { name: IS_DATE_STRING, validator: { - validate: (value, args) => isDateString(value), + validate: (value, args): boolean => isDateString(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a ISOString", validationOptions diff --git a/src/decorator/string/IsDecimal.ts b/src/decorator/string/IsDecimal.ts index 1fc5f56feb..71d34bde12 100644 --- a/src/decorator/string/IsDecimal.ts +++ b/src/decorator/string/IsDecimal.ts @@ -22,7 +22,7 @@ export function IsDecimal(options?: ValidatorJS.IsDecimalOptions, validationOpti name: IS_DECIMAL, constraints: [options], validator: { - validate: (value, args) => isDecimal(value, args.constraints[0]), + validate: (value, args): boolean => isDecimal(value, args.constraints[0]), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property is not a valid decimal number.", validationOptions diff --git a/src/decorator/string/IsEAN.ts b/src/decorator/string/IsEAN.ts index d73d226108..687f911355 100644 --- a/src/decorator/string/IsEAN.ts +++ b/src/decorator/string/IsEAN.ts @@ -21,7 +21,7 @@ export function IsEAN(validationOptions?: ValidationOptions): PropertyDecorator { name: IS_EAN, validator: { - validate: (value, args) => isEAN(value), + validate: (value, args): boolean => isEAN(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be an EAN (European Article Number)", validationOptions diff --git a/src/decorator/string/IsEmail.ts b/src/decorator/string/IsEmail.ts index 532912cdd5..173d8a25a4 100644 --- a/src/decorator/string/IsEmail.ts +++ b/src/decorator/string/IsEmail.ts @@ -22,7 +22,7 @@ export function IsEmail(options?: ValidatorJS.IsEmailOptions, validationOptions? name: IS_EMAIL, constraints: [options], validator: { - validate: (value, args) => isEmail(value, args.constraints[0]), + validate: (value, args): boolean => isEmail(value, args.constraints[0]), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be an email", validationOptions diff --git a/src/decorator/string/IsEthereumAddress.ts b/src/decorator/string/IsEthereumAddress.ts index e0f06ff7bb..229ec459de 100644 --- a/src/decorator/string/IsEthereumAddress.ts +++ b/src/decorator/string/IsEthereumAddress.ts @@ -21,7 +21,7 @@ export function IsEthereumAddress(validationOptions?: ValidationOptions): Proper { name: IS_ETHEREUM_ADDRESS, validator: { - validate: (value, args) => isEthereumAddress(value), + validate: (value, args): boolean => isEthereumAddress(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be an Ethereum address", validationOptions diff --git a/src/decorator/string/IsFQDN.ts b/src/decorator/string/IsFQDN.ts index 0d8820011a..3fa315ae0d 100644 --- a/src/decorator/string/IsFQDN.ts +++ b/src/decorator/string/IsFQDN.ts @@ -22,7 +22,7 @@ export function IsFQDN(options?: ValidatorJS.IsFQDNOptions, validationOptions?: name: IS_FQDN, constraints: [options], validator: { - validate: (value, args) => isFQDN(value, args.constraints[0]), + validate: (value, args): boolean => isFQDN(value, args.constraints[0]), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a valid domain name", validationOptions diff --git a/src/decorator/string/IsFirebasePushId.ts b/src/decorator/string/IsFirebasePushId.ts index 7dfb09618f..97cc3c933d 100644 --- a/src/decorator/string/IsFirebasePushId.ts +++ b/src/decorator/string/IsFirebasePushId.ts @@ -21,7 +21,7 @@ export function IsFirebasePushId(validationOptions?: ValidationOptions): Propert { name: IS_FIREBASE_PUSH_ID, validator: { - validate: (value, args) => isFirebasePushId(value), + validate: (value, args): boolean => isFirebasePushId(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a Firebase Push Id", validationOptions diff --git a/src/decorator/string/IsFullWidth.ts b/src/decorator/string/IsFullWidth.ts index b466bdf336..0dc9e20e12 100644 --- a/src/decorator/string/IsFullWidth.ts +++ b/src/decorator/string/IsFullWidth.ts @@ -21,7 +21,7 @@ export function IsFullWidth(validationOptions?: ValidationOptions): PropertyDeco { name: IS_FULL_WIDTH, validator: { - validate: (value, args) => isFullWidth(value), + validate: (value, args): boolean => isFullWidth(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must contain a full-width characters", validationOptions diff --git a/src/decorator/string/IsHSL.ts b/src/decorator/string/IsHSL.ts index 842a51af22..c3b0bceea5 100644 --- a/src/decorator/string/IsHSL.ts +++ b/src/decorator/string/IsHSL.ts @@ -23,7 +23,7 @@ export function IsHSL(validationOptions?: ValidationOptions): PropertyDecorator { name: IS_HSL, validator: { - validate: (value, args) => isHSL(value), + validate: (value, args): boolean => isHSL(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a HSL color", validationOptions diff --git a/src/decorator/string/IsHalfWidth.ts b/src/decorator/string/IsHalfWidth.ts index be1e12185d..3166031156 100644 --- a/src/decorator/string/IsHalfWidth.ts +++ b/src/decorator/string/IsHalfWidth.ts @@ -21,7 +21,7 @@ export function IsHalfWidth(validationOptions?: ValidationOptions): PropertyDeco { name: IS_HALF_WIDTH, validator: { - validate: (value, args) => isHalfWidth(value), + validate: (value, args): boolean => isHalfWidth(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must contain a half-width characters", validationOptions diff --git a/src/decorator/string/IsHash.ts b/src/decorator/string/IsHash.ts index cf647bd4cf..c7b6017bc5 100644 --- a/src/decorator/string/IsHash.ts +++ b/src/decorator/string/IsHash.ts @@ -24,7 +24,7 @@ export function IsHash(algorithm: string, validationOptions?: ValidationOptions) name: IS_HASH, constraints: [algorithm], validator: { - validate: (value, args) => isHash(value, args.constraints[0]), + validate: (value, args): boolean => isHash(value, args.constraints[0]), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a hash of type $constraint1", validationOptions diff --git a/src/decorator/string/IsHexColor.ts b/src/decorator/string/IsHexColor.ts index 5ab0a8de91..7daef132b8 100644 --- a/src/decorator/string/IsHexColor.ts +++ b/src/decorator/string/IsHexColor.ts @@ -21,7 +21,7 @@ export function IsHexColor(validationOptions?: ValidationOptions): PropertyDecor { name: IS_HEX_COLOR, validator: { - validate: (value, args) => isHexColor(value), + validate: (value, args): boolean => isHexColor(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a hexadecimal color", validationOptions diff --git a/src/decorator/string/IsHexadecimal.ts b/src/decorator/string/IsHexadecimal.ts index 6b6bf7c118..0656ce9916 100644 --- a/src/decorator/string/IsHexadecimal.ts +++ b/src/decorator/string/IsHexadecimal.ts @@ -21,7 +21,7 @@ export function IsHexadecimal(validationOptions?: ValidationOptions): PropertyDe { name: IS_HEXADECIMAL, validator: { - validate: (value, args) => isHexadecimal(value), + validate: (value, args): boolean => isHexadecimal(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a hexadecimal number", validationOptions diff --git a/src/decorator/string/IsIBAN.ts b/src/decorator/string/IsIBAN.ts index 511514b403..a381f44766 100644 --- a/src/decorator/string/IsIBAN.ts +++ b/src/decorator/string/IsIBAN.ts @@ -21,7 +21,7 @@ export function IsIBAN(validationOptions?: ValidationOptions): PropertyDecorator { name: IS_IBAN, validator: { - validate: (value, args) => isIBAN(value), + validate: (value, args): boolean => isIBAN(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be an IBAN", validationOptions diff --git a/src/decorator/string/IsIP.ts b/src/decorator/string/IsIP.ts index 3a05cc5c89..0b2c6481de 100644 --- a/src/decorator/string/IsIP.ts +++ b/src/decorator/string/IsIP.ts @@ -25,7 +25,7 @@ export function IsIP(version?: IsIpVersion, validationOptions?: ValidationOption name: IS_IP, constraints: [version], validator: { - validate: (value, args) => isIP(value, args.constraints[0]), + validate: (value, args): boolean => isIP(value, args.constraints[0]), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be an ip address", validationOptions diff --git a/src/decorator/string/IsISBN.ts b/src/decorator/string/IsISBN.ts index 58c68344eb..c65e645700 100644 --- a/src/decorator/string/IsISBN.ts +++ b/src/decorator/string/IsISBN.ts @@ -25,7 +25,7 @@ export function IsISBN(version?: IsISBNVersion, validationOptions?: ValidationOp name: IS_ISBN, constraints: [version], validator: { - validate: (value, args) => isISBN(value, args.constraints[0]), + validate: (value, args): boolean => isISBN(value, args.constraints[0]), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be an ISBN", validationOptions diff --git a/src/decorator/string/IsISIN.ts b/src/decorator/string/IsISIN.ts index 95f3157438..bd20b4d50b 100644 --- a/src/decorator/string/IsISIN.ts +++ b/src/decorator/string/IsISIN.ts @@ -21,7 +21,7 @@ export function IsISIN(validationOptions?: ValidationOptions): PropertyDecorator { name: IS_ISIN, validator: { - validate: (value, args) => isISIN(value), + validate: (value, args): boolean => isISIN(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be an ISIN (stock/security identifier)", validationOptions diff --git a/src/decorator/string/IsISO31661Alpha2.ts b/src/decorator/string/IsISO31661Alpha2.ts index 79c7fe106b..89d63d8fb4 100644 --- a/src/decorator/string/IsISO31661Alpha2.ts +++ b/src/decorator/string/IsISO31661Alpha2.ts @@ -19,7 +19,7 @@ export function IsISO31661Alpha2(validationOptions?: ValidationOptions): Propert { name: IS_ISO31661_ALPHA_2, validator: { - validate: (value, args) => isISO31661Alpha2(value), + validate: (value, args): boolean => isISO31661Alpha2(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a valid ISO31661 Alpha2 code", validationOptions diff --git a/src/decorator/string/IsISO31661Alpha3.ts b/src/decorator/string/IsISO31661Alpha3.ts index 0942114706..b0d83a6d7d 100644 --- a/src/decorator/string/IsISO31661Alpha3.ts +++ b/src/decorator/string/IsISO31661Alpha3.ts @@ -19,7 +19,7 @@ export function IsISO31661Alpha3(validationOptions?: ValidationOptions): Propert { name: IS_ISO31661_ALPHA_3, validator: { - validate: (value, args) => isISO31661Alpha3(value), + validate: (value, args): boolean => isISO31661Alpha3(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a valid ISO31661 Alpha3 code", validationOptions diff --git a/src/decorator/string/IsISO8601.ts b/src/decorator/string/IsISO8601.ts index 3faebc9c12..c29982d81d 100644 --- a/src/decorator/string/IsISO8601.ts +++ b/src/decorator/string/IsISO8601.ts @@ -24,7 +24,7 @@ export function IsISO8601(options?: ValidatorJS.IsISO8601Options, validationOpti name: IS_ISO8601, constraints: [options], validator: { - validate: (value, args) => isISO8601(value, args.constraints[0]), + validate: (value, args): boolean => isISO8601(value, args.constraints[0]), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a valid ISO 8601 date string", validationOptions diff --git a/src/decorator/string/IsISRC.ts b/src/decorator/string/IsISRC.ts index ed6e9a73c1..4550a441f3 100644 --- a/src/decorator/string/IsISRC.ts +++ b/src/decorator/string/IsISRC.ts @@ -21,7 +21,7 @@ export function IsISRC(validationOptions?: ValidationOptions): PropertyDecorator { name: IS_ISRC, validator: { - validate: (value, args) => isISRC(value), + validate: (value, args): boolean => isISRC(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be an ISRC", validationOptions diff --git a/src/decorator/string/IsISSN.ts b/src/decorator/string/IsISSN.ts index ba3bab7916..7507136d48 100644 --- a/src/decorator/string/IsISSN.ts +++ b/src/decorator/string/IsISSN.ts @@ -22,7 +22,7 @@ export function IsISSN(options?: ValidatorJS.IsISSNOptions, validationOptions?: name: IS_ISSN, constraints: [options], validator: { - validate: (value, args) => isISSN(value, args.constraints[0]), + validate: (value, args): boolean => isISSN(value, args.constraints[0]), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a ISSN", validationOptions diff --git a/src/decorator/string/IsIdentityCard.ts b/src/decorator/string/IsIdentityCard.ts index 6da4f8d5f6..7eea6ec59f 100644 --- a/src/decorator/string/IsIdentityCard.ts +++ b/src/decorator/string/IsIdentityCard.ts @@ -26,7 +26,7 @@ export function IsIdentityCard(locale?: ValidatorJS.IdentityCardLocale, validati name: IS_IDENTITY_CARD, constraints: [locale], validator: { - validate: (value, args) => isIdentityCard(value, args.constraints[0]), + validate: (value, args): boolean => isIdentityCard(value, args.constraints[0]), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a identity card number", validationOptions diff --git a/src/decorator/string/IsJSON.ts b/src/decorator/string/IsJSON.ts index 92f1805e47..99d8b32f8f 100644 --- a/src/decorator/string/IsJSON.ts +++ b/src/decorator/string/IsJSON.ts @@ -21,7 +21,7 @@ export function IsJSON(validationOptions?: ValidationOptions): PropertyDecorator { name: IS_JSON, validator: { - validate: (value, args) => isJSON(value), + validate: (value, args): boolean => isJSON(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a json string", validationOptions diff --git a/src/decorator/string/IsJWT.ts b/src/decorator/string/IsJWT.ts index 21a1811675..3e5740cdd6 100644 --- a/src/decorator/string/IsJWT.ts +++ b/src/decorator/string/IsJWT.ts @@ -21,7 +21,7 @@ export function IsJWT(validationOptions?: ValidationOptions): PropertyDecorator { name: IS_JWT, validator: { - validate: (value, args) => isJWT(value), + validate: (value, args): boolean => isJWT(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a jwt string", validationOptions diff --git a/src/decorator/string/IsLocale.ts b/src/decorator/string/IsLocale.ts index 3cd3a93b53..8b10b0f7f9 100644 --- a/src/decorator/string/IsLocale.ts +++ b/src/decorator/string/IsLocale.ts @@ -21,7 +21,7 @@ export function IsLocale(validationOptions?: ValidationOptions): PropertyDecorat { name: IS_LOCALE, validator: { - validate: (value, args) => isLocale(value), + validate: (value, args): boolean => isLocale(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be locale", validationOptions diff --git a/src/decorator/string/IsLowercase.ts b/src/decorator/string/IsLowercase.ts index 38fea6d79c..15dd4b77d7 100644 --- a/src/decorator/string/IsLowercase.ts +++ b/src/decorator/string/IsLowercase.ts @@ -21,7 +21,7 @@ export function IsLowercase(validationOptions?: ValidationOptions): PropertyDeco { name: IS_LOWERCASE, validator: { - validate: (value, args) => isLowercase(value), + validate: (value, args): boolean => isLowercase(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a lowercase string", validationOptions diff --git a/src/decorator/string/IsMacAddress.ts b/src/decorator/string/IsMacAddress.ts index 2aeb0810af..694f305706 100644 --- a/src/decorator/string/IsMacAddress.ts +++ b/src/decorator/string/IsMacAddress.ts @@ -27,7 +27,7 @@ export function IsMACAddress(optionsOrValidationOptionsArg?: ValidatorJS.IsMACAd name: IS_MAC_ADDRESS, constraints: [options], validator: { - validate: (value, args) => isMACAddress(value, options), + validate: (value, args): boolean => isMACAddress(value, options), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a MAC Address", validationOptions diff --git a/src/decorator/string/IsMagnetURI.ts b/src/decorator/string/IsMagnetURI.ts index 8c2595c831..865605e4de 100644 --- a/src/decorator/string/IsMagnetURI.ts +++ b/src/decorator/string/IsMagnetURI.ts @@ -21,7 +21,7 @@ export function IsMagnetURI(validationOptions?: ValidationOptions): PropertyDeco { name: IS_MAGNET_URI, validator: { - validate: (value, args) => isMagnetURI(value), + validate: (value, args): boolean => isMagnetURI(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be magnet uri format", validationOptions diff --git a/src/decorator/string/IsMilitaryTime.ts b/src/decorator/string/IsMilitaryTime.ts index 6c49a61e53..0200ee7b73 100644 --- a/src/decorator/string/IsMilitaryTime.ts +++ b/src/decorator/string/IsMilitaryTime.ts @@ -22,7 +22,7 @@ export function IsMilitaryTime(validationOptions?: ValidationOptions): PropertyD { name: IS_MILITARY_TIME, validator: { - validate: (value, args) => isMilitaryTime(value), + validate: (value, args): boolean => isMilitaryTime(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a valid representation of military time in the format HH:MM", validationOptions diff --git a/src/decorator/string/IsMimeType.ts b/src/decorator/string/IsMimeType.ts index 9ae2b51451..e848ecc55a 100644 --- a/src/decorator/string/IsMimeType.ts +++ b/src/decorator/string/IsMimeType.ts @@ -21,7 +21,7 @@ export function IsMimeType(validationOptions?: ValidationOptions): PropertyDecor { name: IS_MIME_TYPE, validator: { - validate: (value, args) => isMimeType(value), + validate: (value, args): boolean => isMimeType(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be MIME type format", validationOptions diff --git a/src/decorator/string/IsMobilePhone.ts b/src/decorator/string/IsMobilePhone.ts index 1fa3cebc67..e26be4d420 100644 --- a/src/decorator/string/IsMobilePhone.ts +++ b/src/decorator/string/IsMobilePhone.ts @@ -38,7 +38,7 @@ export function IsMobilePhone(locale?: validator.MobilePhoneLocale, options?: va name: IS_MOBILE_PHONE, constraints: [locale, options], validator: { - validate: (value, args) => isMobilePhone(value, args.constraints[0], args.constraints[1]), + validate: (value, args): boolean => isMobilePhone(value, args.constraints[0], args.constraints[1]), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a phone number", validationOptions diff --git a/src/decorator/string/IsMongoId.ts b/src/decorator/string/IsMongoId.ts index 33bc0eac47..91c868e15d 100644 --- a/src/decorator/string/IsMongoId.ts +++ b/src/decorator/string/IsMongoId.ts @@ -21,7 +21,7 @@ export function IsMongoId(validationOptions?: ValidationOptions): PropertyDecora { name: IS_MONGO_ID, validator: { - validate: (value, args) => isMongoId(value), + validate: (value, args): boolean => isMongoId(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a mongodb id", validationOptions diff --git a/src/decorator/string/IsMultibyte.ts b/src/decorator/string/IsMultibyte.ts index cac35df1c1..0cdd306b46 100644 --- a/src/decorator/string/IsMultibyte.ts +++ b/src/decorator/string/IsMultibyte.ts @@ -21,7 +21,7 @@ export function IsMultibyte(validationOptions?: ValidationOptions): PropertyDeco { name: IS_MULTIBYTE, validator: { - validate: (value, args) => isMultibyte(value), + validate: (value, args): boolean => isMultibyte(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must contain one or more multibyte chars", validationOptions diff --git a/src/decorator/string/IsNumberString.ts b/src/decorator/string/IsNumberString.ts index f58aa2d8b7..08a1363dc3 100644 --- a/src/decorator/string/IsNumberString.ts +++ b/src/decorator/string/IsNumberString.ts @@ -22,7 +22,7 @@ export function IsNumberString(options?: ValidatorJS.IsNumericOptions, validatio name: IS_NUMBER_STRING, constraints: [options], validator: { - validate: (value, args) => isNumberString(value, args.constraints[0]), + validate: (value, args): boolean => isNumberString(value, args.constraints[0]), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a number string", validationOptions diff --git a/src/decorator/string/IsOctal.ts b/src/decorator/string/IsOctal.ts index 83b9fd0e81..23403998a5 100644 --- a/src/decorator/string/IsOctal.ts +++ b/src/decorator/string/IsOctal.ts @@ -21,7 +21,7 @@ export function IsOctal(validationOptions?: ValidationOptions): PropertyDecorato { name: IS_OCTAL, validator: { - validate: (value, args) => isOctal(value), + validate: (value, args): boolean => isOctal(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be valid octal number", validationOptions diff --git a/src/decorator/string/IsPassportNumber.ts b/src/decorator/string/IsPassportNumber.ts index 4f6f1f5351..c86e2f2fcd 100644 --- a/src/decorator/string/IsPassportNumber.ts +++ b/src/decorator/string/IsPassportNumber.ts @@ -22,7 +22,7 @@ export function IsPassportNumber(countryCode: string, validationOptions?: Valida name: IS_PASSPORT_NUMBER, constraints: [countryCode], validator: { - validate: (value, args) => isPassportNumber(value, args.constraints[0]), + validate: (value, args): boolean => isPassportNumber(value, args.constraints[0]), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be valid passport number", validationOptions diff --git a/src/decorator/string/IsPhoneNumber.ts b/src/decorator/string/IsPhoneNumber.ts index f313b58997..c514da0758 100644 --- a/src/decorator/string/IsPhoneNumber.ts +++ b/src/decorator/string/IsPhoneNumber.ts @@ -35,7 +35,7 @@ export function IsPhoneNumber(region: string | null, validationOptions?: Validat name: IS_PHONE_NUMBER, constraints: [region], validator: { - validate: (value, args) => isPhoneNumber(value, args.constraints[0]), + validate: (value, args): boolean => isPhoneNumber(value, args.constraints[0]), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a valid phone number", validationOptions diff --git a/src/decorator/string/IsPort.ts b/src/decorator/string/IsPort.ts index 6fae4abe0d..13c3af3bcb 100644 --- a/src/decorator/string/IsPort.ts +++ b/src/decorator/string/IsPort.ts @@ -19,7 +19,7 @@ export function IsPort(validationOptions?: ValidationOptions): PropertyDecorator { name: IS_PORT, validator: { - validate: (value, args) => isPort(value), + validate: (value, args): boolean => isPort(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a port", validationOptions diff --git a/src/decorator/string/IsPostalCode.ts b/src/decorator/string/IsPostalCode.ts index c7e2c67405..3c031d0cbb 100644 --- a/src/decorator/string/IsPostalCode.ts +++ b/src/decorator/string/IsPostalCode.ts @@ -24,7 +24,7 @@ export function IsPostalCode(locale?: validator.PostalCodeLocale, validationOpti name: IS_POSTAL_CODE, constraints: [locale], validator: { - validate: (value, args) => isPostalCode(value, args.constraints[0]), + validate: (value, args): boolean => isPostalCode(value, args.constraints[0]), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a postal code", validationOptions diff --git a/src/decorator/string/IsRFC3339.ts b/src/decorator/string/IsRFC3339.ts index 792de222f6..51a1bb0c4d 100644 --- a/src/decorator/string/IsRFC3339.ts +++ b/src/decorator/string/IsRFC3339.ts @@ -21,7 +21,7 @@ export function IsRFC3339(validationOptions?: ValidationOptions): PropertyDecora { name: IS_RFC_3339, validator: { - validate: (value, args) => isRFC3339(value), + validate: (value, args): boolean => isRFC3339(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be RFC 3339 date", validationOptions diff --git a/src/decorator/string/IsRgbColor.ts b/src/decorator/string/IsRgbColor.ts index 85bdbfd873..1d91898364 100644 --- a/src/decorator/string/IsRgbColor.ts +++ b/src/decorator/string/IsRgbColor.ts @@ -24,7 +24,7 @@ export function IsRgbColor(includePercentValues?: boolean, validationOptions?: V name: IS_RGB_COLOR, constraints: [includePercentValues], validator: { - validate: (value, args) => isRgbColor(value, args.constraints[0]), + validate: (value, args): boolean => isRgbColor(value, args.constraints[0]), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be RGB color", validationOptions diff --git a/src/decorator/string/IsSemVer.ts b/src/decorator/string/IsSemVer.ts index 2205baebf9..202026435b 100644 --- a/src/decorator/string/IsSemVer.ts +++ b/src/decorator/string/IsSemVer.ts @@ -21,7 +21,7 @@ export function IsSemVer(validationOptions?: ValidationOptions): PropertyDecorat { name: IS_SEM_VER, validator: { - validate: (value, args) => isSemVer(value), + validate: (value, args): boolean => isSemVer(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a Semantic Versioning Specification", validationOptions diff --git a/src/decorator/string/IsSurrogatePair.ts b/src/decorator/string/IsSurrogatePair.ts index 5e55b69991..72aaccc66a 100644 --- a/src/decorator/string/IsSurrogatePair.ts +++ b/src/decorator/string/IsSurrogatePair.ts @@ -21,7 +21,7 @@ export function IsSurrogatePair(validationOptions?: ValidationOptions): Property { name: IS_SURROGATE_PAIR, validator: { - validate: (value, args) => isSurrogatePair(value), + validate: (value, args): boolean => isSurrogatePair(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must contain any surrogate pairs chars", validationOptions diff --git a/src/decorator/string/IsUUID.ts b/src/decorator/string/IsUUID.ts index c352e7c558..9f140ac74a 100644 --- a/src/decorator/string/IsUUID.ts +++ b/src/decorator/string/IsUUID.ts @@ -24,7 +24,7 @@ export function IsUUID(version?: UUIDVersion, validationOptions?: ValidationOpti name: IS_UUID, constraints: [version], validator: { - validate: (value, args) => isUUID(value, args.constraints[0]), + validate: (value, args): boolean => isUUID(value, args.constraints[0]), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be an UUID", validationOptions diff --git a/src/decorator/string/IsUppercase.ts b/src/decorator/string/IsUppercase.ts index f4e20d8b20..fd1504e682 100644 --- a/src/decorator/string/IsUppercase.ts +++ b/src/decorator/string/IsUppercase.ts @@ -21,7 +21,7 @@ export function IsUppercase(validationOptions?: ValidationOptions): PropertyDeco { name: IS_UPPERCASE, validator: { - validate: (value, args) => isUppercase(value), + validate: (value, args): boolean => isUppercase(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be uppercase", validationOptions diff --git a/src/decorator/string/IsUrl.ts b/src/decorator/string/IsUrl.ts index 4442115ff5..23ae981aa8 100644 --- a/src/decorator/string/IsUrl.ts +++ b/src/decorator/string/IsUrl.ts @@ -22,7 +22,7 @@ export function IsUrl(options?: ValidatorJS.IsURLOptions, validationOptions?: Va name: IS_URL, constraints: [options], validator: { - validate: (value, args) => isURL(value, args.constraints[0]), + validate: (value, args): boolean => isURL(value, args.constraints[0]), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be an URL address", validationOptions diff --git a/src/decorator/string/IsVariableWidth.ts b/src/decorator/string/IsVariableWidth.ts index 429af136a6..f601cfba51 100644 --- a/src/decorator/string/IsVariableWidth.ts +++ b/src/decorator/string/IsVariableWidth.ts @@ -21,7 +21,7 @@ export function IsVariableWidth(validationOptions?: ValidationOptions): Property { name: IS_VARIABLE_WIDTH, validator: { - validate: (value, args) => isVariableWidth(value), + validate: (value, args): boolean => isVariableWidth(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must contain a full-width and half-width characters", validationOptions diff --git a/src/decorator/string/Length.ts b/src/decorator/string/Length.ts index f4181d37f9..ab10bfbb08 100644 --- a/src/decorator/string/Length.ts +++ b/src/decorator/string/Length.ts @@ -22,7 +22,7 @@ export function Length(min: number, max?: number, validationOptions?: Validation name: LENGTH, constraints: [min, max], validator: { - validate: (value, args) => length(value, args.constraints[0], args.constraints[1]), + validate: (value, args): boolean => length(value, args.constraints[0], args.constraints[1]), defaultMessage: buildMessage( (eachPrefix, args) => { const isMinLength = args.constraints[0] !== null && args.constraints[0] !== undefined; diff --git a/src/decorator/string/Matches.ts b/src/decorator/string/Matches.ts index 3d2abd1b63..8a075c5706 100644 --- a/src/decorator/string/Matches.ts +++ b/src/decorator/string/Matches.ts @@ -23,7 +23,7 @@ export function Matches(pattern: string, modifiers?: string, validationOptions?: export function Matches(pattern: RegExp | string, modifiersOrAnnotationOptions?: string | ValidationOptions, validationOptions?: ValidationOptions): PropertyDecorator { let modifiers: string; if (modifiersOrAnnotationOptions && modifiersOrAnnotationOptions instanceof Object && !validationOptions) { - validationOptions = modifiersOrAnnotationOptions as ValidationOptions; + validationOptions = modifiersOrAnnotationOptions; } else { modifiers = modifiersOrAnnotationOptions as string; } @@ -33,7 +33,7 @@ export function Matches(pattern: RegExp | string, modifiersOrAnnotationOptions?: name: MATCHES, constraints: [pattern, modifiers], validator: { - validate: (value, args) => matches(value, args.constraints[0], args.constraints[0]), + validate: (value, args): boolean => matches(value, args.constraints[0], args.constraints[0]), defaultMessage: buildMessage( (eachPrefix, args) => eachPrefix + "$property must match $constraint1 regular expression", validationOptions diff --git a/src/decorator/string/MaxLength.ts b/src/decorator/string/MaxLength.ts index c91b08ff60..2f024870bc 100644 --- a/src/decorator/string/MaxLength.ts +++ b/src/decorator/string/MaxLength.ts @@ -8,7 +8,7 @@ export const MAX_LENGTH = "maxLength"; * Checks if the string's length is not more than given number. Note: this function takes into account surrogate pairs. * If given value is not a string, then it returns false. */ -export function maxLength(value: unknown, max: number) { +export function maxLength(value: unknown, max: number): boolean { return typeof value === "string" && validator.isLength(value, { min: 0, max }); } @@ -22,7 +22,7 @@ export function MaxLength(max: number, validationOptions?: ValidationOptions): P name: MAX_LENGTH, constraints: [max], validator: { - validate: (value, args) => maxLength(value, args.constraints[0]), + validate: (value, args): boolean => maxLength(value, args.constraints[0]), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be shorter than or equal to $constraint1 characters", validationOptions diff --git a/src/decorator/string/MinLength.ts b/src/decorator/string/MinLength.ts index 6f6d8ff612..2238fe81e2 100644 --- a/src/decorator/string/MinLength.ts +++ b/src/decorator/string/MinLength.ts @@ -8,7 +8,7 @@ export const MIN_LENGTH = "minLength"; * Checks if the string's length is not less than given number. Note: this function takes into account surrogate pairs. * If given value is not a string, then it returns false. */ -export function minLength(value: unknown, min: number) { +export function minLength(value: unknown, min: number): boolean { return typeof value === "string" && validator.isLength(value, { min }); } @@ -22,7 +22,7 @@ export function MinLength(min: number, validationOptions?: ValidationOptions): P name: MIN_LENGTH, constraints: [min], validator: { - validate: (value, args) => minLength(value, args.constraints[0]), + validate: (value, args): boolean => minLength(value, args.constraints[0]), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be longer than or equal to $constraint1 characters", validationOptions diff --git a/src/decorator/string/NotContains.ts b/src/decorator/string/NotContains.ts index bb7589fc2b..e8ca277916 100644 --- a/src/decorator/string/NotContains.ts +++ b/src/decorator/string/NotContains.ts @@ -22,7 +22,7 @@ export function NotContains(seed: string, validationOptions?: ValidationOptions) name: NOT_CONTAINS, constraints: [seed], validator: { - validate: (value, args) => notContains(value, args.constraints[0]), + validate: (value, args): boolean => notContains(value, args.constraints[0]), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property should not contain a $constraint1 string", validationOptions diff --git a/src/decorator/typechecker/IsArray.ts b/src/decorator/typechecker/IsArray.ts index 544de15dd2..89d26f4727 100644 --- a/src/decorator/typechecker/IsArray.ts +++ b/src/decorator/typechecker/IsArray.ts @@ -18,7 +18,7 @@ export function IsArray(validationOptions?: ValidationOptions): PropertyDecorato { name: IS_ARRAY, validator: { - validate: (value, args) => isArray(value), + validate: (value, args): boolean => isArray(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be an array", validationOptions diff --git a/src/decorator/typechecker/IsBoolean.ts b/src/decorator/typechecker/IsBoolean.ts index 7763a2f3b7..6c61d889f6 100644 --- a/src/decorator/typechecker/IsBoolean.ts +++ b/src/decorator/typechecker/IsBoolean.ts @@ -18,7 +18,7 @@ export function IsBoolean(validationOptions?: ValidationOptions): PropertyDecora { name: IS_BOOLEAN, validator: { - validate: (value, args) => isBoolean(value), + validate: (value, args): boolean => isBoolean(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a boolean value", validationOptions diff --git a/src/decorator/typechecker/IsDate.ts b/src/decorator/typechecker/IsDate.ts index a5360af6c6..c6fc5a73ea 100644 --- a/src/decorator/typechecker/IsDate.ts +++ b/src/decorator/typechecker/IsDate.ts @@ -18,7 +18,7 @@ export function IsDate(validationOptions?: ValidationOptions): PropertyDecorator { name: IS_DATE, validator: { - validate: (value, args) => isDate(value), + validate: (value, args): boolean => isDate(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a Date instance", validationOptions diff --git a/src/decorator/typechecker/IsEnum.ts b/src/decorator/typechecker/IsEnum.ts index 9e16f655ee..bb6071229c 100644 --- a/src/decorator/typechecker/IsEnum.ts +++ b/src/decorator/typechecker/IsEnum.ts @@ -15,13 +15,13 @@ export function isEnum(value: unknown, entity: any): boolean { /** * Checks if a given value is an enum */ -export function IsEnum(entity: Object, validationOptions?: ValidationOptions): PropertyDecorator { +export function IsEnum(entity: object, validationOptions?: ValidationOptions): PropertyDecorator { return ValidateBy( { name: IS_ENUM, constraints: [entity], validator: { - validate: (value, args) => isEnum(value, args.constraints[0]), + validate: (value, args): boolean => isEnum(value, args.constraints[0]), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a valid enum value", validationOptions diff --git a/src/decorator/typechecker/IsInt.ts b/src/decorator/typechecker/IsInt.ts index 2cf5ac3ac0..e563f43e93 100644 --- a/src/decorator/typechecker/IsInt.ts +++ b/src/decorator/typechecker/IsInt.ts @@ -18,7 +18,7 @@ export function IsInt(validationOptions?: ValidationOptions): PropertyDecorator { name: IS_INT, validator: { - validate: (value, args) => isInt(value), + validate: (value, args): boolean => isInt(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be an integer number", validationOptions diff --git a/src/decorator/typechecker/IsNumber.ts b/src/decorator/typechecker/IsNumber.ts index 65c5d28f5e..495e90e52b 100644 --- a/src/decorator/typechecker/IsNumber.ts +++ b/src/decorator/typechecker/IsNumber.ts @@ -50,7 +50,7 @@ export function IsNumber(options: IsNumberOptions = {}, validationOptions?: Vali name: IS_NUMBER, constraints: [options], validator: { - validate: (value, args) => isNumber(value, args.constraints[0]), + validate: (value, args): boolean => isNumber(value, args.constraints[0]), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a number conforming to the specified constraints", validationOptions diff --git a/src/decorator/typechecker/IsObject.ts b/src/decorator/typechecker/IsObject.ts index 5c7c0e2ff3..01601c4feb 100644 --- a/src/decorator/typechecker/IsObject.ts +++ b/src/decorator/typechecker/IsObject.ts @@ -20,7 +20,7 @@ export function IsObject(validationOptions?: ValidationOptions): PropertyDecorat { name: IS_OBJECT, validator: { - validate: (value, args) => isObject(value), + validate: (value, args): boolean => isObject(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be an object", validationOptions diff --git a/src/decorator/typechecker/IsString.ts b/src/decorator/typechecker/IsString.ts index b843f3888c..ae54b267e9 100644 --- a/src/decorator/typechecker/IsString.ts +++ b/src/decorator/typechecker/IsString.ts @@ -18,7 +18,7 @@ export function IsString(validationOptions?: ValidationOptions): PropertyDecorat { name: IS_STRING, validator: { - validate: (value, args) => isString(value), + validate: (value, args): boolean => isString(value), defaultMessage: buildMessage( (eachPrefix) => eachPrefix + "$property must be a string", validationOptions diff --git a/src/index.ts b/src/index.ts index dcec7876a8..49523b7bd1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -29,46 +29,46 @@ export * from "./metadata/MetadataStorage"; /** * Validates given object. */ -export function validate(object: Object, validatorOptions?: ValidatorOptions): Promise; +export function validate(object: object, validatorOptions?: ValidatorOptions): Promise; /** * Validates given object by a given validation schema. */ -export function validate(schemaName: string, object: Object, validatorOptions?: ValidatorOptions): Promise; +export function validate(schemaName: string, object: object, validatorOptions?: ValidatorOptions): Promise; /** * Validates given object by object's decorators or given validation schema. */ -export function validate(schemaNameOrObject: Object|string, - objectOrValidationOptions?: Object|ValidatorOptions, +export function validate(schemaNameOrObject: object|string, + objectOrValidationOptions?: object|ValidatorOptions, maybeValidatorOptions?: ValidatorOptions): Promise { if (typeof schemaNameOrObject === "string") { - return getFromContainer(Validator).validate(schemaNameOrObject as string, objectOrValidationOptions as Object, maybeValidatorOptions); + return getFromContainer(Validator).validate(schemaNameOrObject, objectOrValidationOptions as object, maybeValidatorOptions); } else { - return getFromContainer(Validator).validate(schemaNameOrObject as Object, objectOrValidationOptions as ValidatorOptions); + return getFromContainer(Validator).validate(schemaNameOrObject, objectOrValidationOptions as ValidatorOptions); } } /** * Validates given object and reject on error. */ -export function validateOrReject(object: Object, validatorOptions?: ValidatorOptions): Promise; +export function validateOrReject(object: object, validatorOptions?: ValidatorOptions): Promise; /** * Validates given object by a given validation schema and reject on error. */ -export function validateOrReject(schemaName: string, object: Object, validatorOptions?: ValidatorOptions): Promise; +export function validateOrReject(schemaName: string, object: object, validatorOptions?: ValidatorOptions): Promise; /** * Validates given object by object's decorators or given validation schema and reject on error. */ -export function validateOrReject(schemaNameOrObject: Object|string, - objectOrValidationOptions?: Object|ValidatorOptions, +export function validateOrReject(schemaNameOrObject: object|string, + objectOrValidationOptions?: object|ValidatorOptions, maybeValidatorOptions?: ValidatorOptions): Promise { if (typeof schemaNameOrObject === "string") { - return getFromContainer(Validator).validateOrReject(schemaNameOrObject as string, objectOrValidationOptions as Object, maybeValidatorOptions); + return getFromContainer(Validator).validateOrReject(schemaNameOrObject, objectOrValidationOptions as object, maybeValidatorOptions); } else { - return getFromContainer(Validator).validateOrReject(schemaNameOrObject as Object, objectOrValidationOptions as ValidatorOptions); + return getFromContainer(Validator).validateOrReject(schemaNameOrObject, objectOrValidationOptions as ValidatorOptions); } } @@ -77,27 +77,27 @@ export function validateOrReject(schemaNameOrObject: Object|string, * Note that this method completely ignores async validations. * If you want to properly perform validation you need to call validate method instead. */ -export function validateSync(object: Object, validatorOptions?: ValidatorOptions): ValidationError[]; +export function validateSync(object: object, validatorOptions?: ValidatorOptions): ValidationError[]; /** * Validates given object by a given validation schema. * Note that this method completely ignores async validations. * If you want to properly perform validation you need to call validate method instead. */ -export function validateSync(schemaName: string, object: Object, validatorOptions?: ValidatorOptions): ValidationError[]; +export function validateSync(schemaName: string, object: object, validatorOptions?: ValidatorOptions): ValidationError[]; /** * Validates given object by object's decorators or given validation schema. * Note that this method completely ignores async validations. * If you want to properly perform validation you need to call validate method instead. */ -export function validateSync(schemaNameOrObject: Object|string, - objectOrValidationOptions?: Object|ValidatorOptions, +export function validateSync(schemaNameOrObject: object|string, + objectOrValidationOptions?: object|ValidatorOptions, maybeValidatorOptions?: ValidatorOptions): ValidationError[] { if (typeof schemaNameOrObject === "string") { - return getFromContainer(Validator).validateSync(schemaNameOrObject as string, objectOrValidationOptions as Object, maybeValidatorOptions); + return getFromContainer(Validator).validateSync(schemaNameOrObject, objectOrValidationOptions as object, maybeValidatorOptions); } else { - return getFromContainer(Validator).validateSync(schemaNameOrObject as Object, objectOrValidationOptions as ValidatorOptions); + return getFromContainer(Validator).validateSync(schemaNameOrObject, objectOrValidationOptions as ValidatorOptions); } } diff --git a/src/metadata/MetadataStorage.ts b/src/metadata/MetadataStorage.ts index be74883302..d3b2156afe 100644 --- a/src/metadata/MetadataStorage.ts +++ b/src/metadata/MetadataStorage.ts @@ -3,20 +3,6 @@ import {ConstraintMetadata} from "./ConstraintMetadata"; import {ValidationSchema} from "../validation-schema/ValidationSchema"; import {ValidationSchemaToMetadataTransformer} from "../validation-schema/ValidationSchemaToMetadataTransformer"; -/** - * Gets metadata storage. - * Metadata storage follows the best practices and stores metadata in a global variable. - */ -export function getMetadataStorage(): MetadataStorage { - if (typeof window !== "undefined") { - (window as any).global = window; - } - if (!(global as any).classValidatorMetadataStorage) - (global as any).classValidatorMetadataStorage = new MetadataStorage(); - - return (global as any).classValidatorMetadataStorage; -} - /** * Storage all metadatas. */ @@ -29,7 +15,7 @@ export class MetadataStorage { private validationMetadatas: ValidationMetadata[] = []; private constraintMetadatas: ConstraintMetadata[] = []; - get hasValidationMetaData() { + get hasValidationMetaData(): boolean { return !!this.validationMetadatas.length; } @@ -40,7 +26,7 @@ export class MetadataStorage { /** * Adds a new validation metadata. */ - addValidationSchema(schema: ValidationSchema) { + addValidationSchema(schema: ValidationSchema): void { const validationMetadatas = new ValidationSchemaToMetadataTransformer().transform(schema); validationMetadatas.forEach(validationMetadata => this.addValidationMetadata(validationMetadata)); } @@ -48,14 +34,14 @@ export class MetadataStorage { /** * Adds a new validation metadata. */ - addValidationMetadata(metadata: ValidationMetadata) { + addValidationMetadata(metadata: ValidationMetadata): void { this.validationMetadatas.push(metadata); } /** * Adds a new constraint metadata. */ - addConstraintMetadata(metadata: ConstraintMetadata) { + addConstraintMetadata(metadata: ConstraintMetadata): void { this.constraintMetadatas.push(metadata); } @@ -97,7 +83,7 @@ export class MetadataStorage { if (metadata.target === targetConstructor) return false; if (metadata.target instanceof Function && - !(targetConstructor.prototype instanceof (metadata.target as Function))) + !(targetConstructor.prototype instanceof (metadata.target))) return false; if (metadata.always) return true; @@ -126,3 +112,17 @@ export class MetadataStorage { } } + +/** + * Gets metadata storage. + * Metadata storage follows the best practices and stores metadata in a global variable. + */ +export function getMetadataStorage(): MetadataStorage { + if (typeof window !== "undefined") { + (window).global = window; + } + if (!(global as any).classValidatorMetadataStorage) + (global as any).classValidatorMetadataStorage = new MetadataStorage(); + + return (global as any).classValidatorMetadataStorage; +} diff --git a/src/register-decorator.ts b/src/register-decorator.ts index 787d45cecf..3516296008 100644 --- a/src/register-decorator.ts +++ b/src/register-decorator.ts @@ -53,19 +53,19 @@ export function registerDecorator(options: ValidationDecoratorOptions): void { let constraintCls: Function; if (options.validator instanceof Function) { - constraintCls = options.validator as Function; + constraintCls = options.validator; const constraintClasses = getFromContainer(MetadataStorage).getTargetValidatorConstraints(options.validator); if (constraintClasses.length > 1) { throw `More than one implementation of ValidatorConstraintInterface found for validator on: ${options.target}:${options.propertyName}`; } } else { - const validator = options.validator as ValidatorConstraintInterface; + const validator = options.validator; constraintCls = class CustomConstraint implements ValidatorConstraintInterface { validate(value: any, validationArguments?: ValidationArguments): Promise|boolean { return validator.validate(value, validationArguments); } - defaultMessage(validationArguments?: ValidationArguments) { + defaultMessage(validationArguments?: ValidationArguments): string { if (validator.defaultMessage) { return validator.defaultMessage(validationArguments); } diff --git a/src/types.d.ts b/src/types.d.ts index 879048a75a..b4b006174d 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -1,4 +1,4 @@ -declare var window: any; +declare let window: any; declare module "ansicolor"; declare module "google-libphonenumber"; diff --git a/src/validation/ValidationArguments.ts b/src/validation/ValidationArguments.ts index 2df2ab7518..3ef08cca32 100644 --- a/src/validation/ValidationArguments.ts +++ b/src/validation/ValidationArguments.ts @@ -22,11 +22,11 @@ export interface ValidationArguments { /** * Object that is being validated. */ - object: Object; + object: object; /** * Name of the object's property being validated. */ property: string; - -} \ No newline at end of file + +} diff --git a/src/validation/ValidationError.ts b/src/validation/ValidationError.ts index d97b7461cb..78fb4ee67b 100644 --- a/src/validation/ValidationError.ts +++ b/src/validation/ValidationError.ts @@ -8,7 +8,7 @@ export class ValidationError { * * OPTIONAL - configurable via the ValidatorOptions.validationError.target option */ - target?: Object; + target?: object; /** * Object's property that haven't pass validation. @@ -26,7 +26,7 @@ export class ValidationError { * Constraints that failed validation with error messages. */ constraints?: { - [type: string]: string + [type: string]: string; }; /** @@ -39,7 +39,7 @@ export class ValidationError { * A transient set of data passed through to the validation result for response mapping */ contexts?: { - [type: string]: any + [type: string]: any; }; /** diff --git a/src/validation/ValidationExecutor.ts b/src/validation/ValidationExecutor.ts index fbee8acf8d..4c44e05784 100644 --- a/src/validation/ValidationExecutor.ts +++ b/src/validation/ValidationExecutor.ts @@ -39,7 +39,7 @@ export class ValidationExecutor { // Public Methods // ------------------------------------------------------------------------- - execute(object: Object, targetSchema: string, validationErrors: ValidationError[]) { + execute(object: object, targetSchema: string, validationErrors: ValidationError[]): void { /** * If there is no metadata registered it means possibly the dependencies are not flatterned and * more than one instance is used. @@ -95,8 +95,8 @@ export class ValidationExecutor { whitelist(object: any, groupedMetadatas: { [propertyName: string]: ValidationMetadata[] }, - validationErrors: ValidationError[]) { - let notAllowedProperties: string[] = []; + validationErrors: ValidationError[]): void { + const notAllowedProperties: string[] = []; Object.keys(object).forEach(propertyName => { // does this property have no metadata? @@ -110,7 +110,7 @@ export class ValidationExecutor { // throw errors notAllowedProperties.forEach(property => { - const validationError: ValidationError = this.generateValidationError(object, (object as any)[property], property); + const validationError: ValidationError = this.generateValidationError(object, (object)[property], property); validationError.constraints = { [ValidationTypes.WHITELIST]: `property ${property} should not exist` }; validationError.children = undefined; validationErrors.push(validationError); @@ -119,13 +119,13 @@ export class ValidationExecutor { } else { // strip non allowed properties - notAllowedProperties.forEach(property => delete (object as any)[property]); + notAllowedProperties.forEach(property => delete (object)[property]); } } } - stripEmptyErrors(errors: ValidationError[]) { + stripEmptyErrors(errors: ValidationError[]): ValidationError[] { return errors.filter(error => { if (error.children) { error.children = this.stripEmptyErrors(error.children); @@ -151,7 +151,7 @@ export class ValidationExecutor { value: any, propertyName: string, definedMetadatas: ValidationMetadata[], metadatas: ValidationMetadata[], - validationErrors: ValidationError[]) { + validationErrors: ValidationError[]): void { const customValidationMetadatas = metadatas.filter(metadata => metadata.type === ValidationTypes.CUSTOM_VALIDATION); const nestedValidationMetadatas = metadatas.filter(metadata => metadata.type === ValidationTypes.NESTED_VALIDATION); @@ -188,7 +188,7 @@ export class ValidationExecutor { this.mapContexts(object, value, customValidationMetadatas, validationError); } - private generateValidationError(object: Object, value: any, propertyName: string) { + private generateValidationError(object: object, value: any, propertyName: string): ValidationError { const validationError = new ValidationError(); if (!this.validatorOptions || @@ -210,18 +210,18 @@ export class ValidationExecutor { return validationError; } - private conditionalValidations(object: Object, + private conditionalValidations(object: object, value: any, - metadatas: ValidationMetadata[]) { + metadatas: ValidationMetadata[]): ValidationMetadata[] { return metadatas .map(metadata => metadata.constraints[0](object, value)) .reduce((resultA, resultB) => resultA && resultB, true); } - private customValidations(object: Object, + private customValidations(object: object, value: any, metadatas: ValidationMetadata[], - error: ValidationError) { + error: ValidationError): void { metadatas.forEach(metadata => { this.metadataStorage @@ -304,7 +304,7 @@ export class ValidationExecutor { }); } - private nestedValidations(value: any, metadatas: ValidationMetadata[], errors: ValidationError[]) { + private nestedValidations(value: any, metadatas: ValidationMetadata[], errors: ValidationError[]): void { if (value === void 0) { return; @@ -326,15 +326,15 @@ export class ValidationExecutor { }); } else if (value instanceof Object) { - const targetSchema = typeof metadata.target === "string" ? metadata.target as string : metadata.target.name; + const targetSchema = typeof metadata.target === "string" ? metadata.target : metadata.target.name; this.execute(value, targetSchema, errors); } else { const error = new ValidationError(); error.value = value; error.property = metadata.propertyName; - error.target = metadata.target; - const [type, message] = this.createValidationError(metadata.target, value, metadata); + error.target = metadata.target as object; + const [type, message] = this.createValidationError(metadata.target as object, value, metadata); error.constraints = { [type]: message }; @@ -343,10 +343,10 @@ export class ValidationExecutor { }); } - private mapContexts(object: Object, + private mapContexts(object: object, value: any, metadatas: ValidationMetadata[], - error: ValidationError) { + error: ValidationError): void { return metadatas .forEach(metadata => { @@ -370,7 +370,7 @@ export class ValidationExecutor { }); } - private createValidationError(object: Object, + private createValidationError(object: object, value: any, metadata: ValidationMetadata, customValidatorMetadata?: ConstraintMetadata): [string, string] { diff --git a/src/validation/ValidationTypes.ts b/src/validation/ValidationTypes.ts index 1aa4f95d8e..235d569613 100644 --- a/src/validation/ValidationTypes.ts +++ b/src/validation/ValidationTypes.ts @@ -14,7 +14,7 @@ export class ValidationTypes { /** * Checks if validation type is valid. */ - static isValid(type: string) { + static isValid(type: string): boolean { return type !== "isValid" && type !== "getMessage" && Object.keys(this).map(key => (this as any)[key]).indexOf(type) !== -1; diff --git a/src/validation/ValidationUtils.ts b/src/validation/ValidationUtils.ts index 0cf8f4112a..51debee3c5 100644 --- a/src/validation/ValidationUtils.ts +++ b/src/validation/ValidationUtils.ts @@ -10,7 +10,7 @@ export class ValidationUtils { messageString = (message as (args: ValidationArguments) => string)(validationArguments); } else if (typeof message === "string") { - messageString = message as string; + messageString = message; } if (messageString && validationArguments.constraints instanceof Array) { @@ -28,5 +28,5 @@ export class ValidationUtils { return messageString; } - -} \ No newline at end of file + +} diff --git a/src/validation/Validator.ts b/src/validation/Validator.ts index daf39e4de1..260ad8a712 100644 --- a/src/validation/Validator.ts +++ b/src/validation/Validator.ts @@ -10,30 +10,6 @@ import * as validator from "validator"; * Validator performs validation of the given object based on its metadata. */ export class Validator { - - // ------------------------------------------------------------------------- - // Private Properties - // ------------------------------------------------------------------------- - - - /** - * Performs validation of the given object based on decorators or validation schema. - * Common method for `validateOrReject` and `validate` methods. - */ - private coreValidate(objectOrSchemaName: Object|string, objectOrValidationOptions: Object|ValidationOptions, maybeValidatorOptions?: ValidatorOptions): Promise { - const object = typeof objectOrSchemaName === "string" ? objectOrValidationOptions as Object : objectOrSchemaName as Object; - const options = typeof objectOrSchemaName === "string" ? maybeValidatorOptions : objectOrValidationOptions as ValidationOptions; - const schema = typeof objectOrSchemaName === "string" ? objectOrSchemaName as string : undefined; - - const executor = new ValidationExecutor(this, options); - const validationErrors: ValidationError[] = []; - executor.execute(object, schema, validationErrors); - - return Promise.all(executor.awaitingPromises).then(() => { - return executor.stripEmptyErrors(validationErrors); - }); - } - // ------------------------------------------------------------------------- // Public Methods // ------------------------------------------------------------------------- @@ -41,34 +17,34 @@ export class Validator { /** * Performs validation of the given object based on decorators used in given object class. */ - validate(object: Object, options?: ValidatorOptions): Promise; + validate(object: object, options?: ValidatorOptions): Promise; /** * Performs validation of the given object based on validation schema. */ - validate(schemaName: string, object: Object, options?: ValidatorOptions): Promise; + validate(schemaName: string, object: object, options?: ValidatorOptions): Promise; /** * Performs validation of the given object based on decorators or validation schema. */ - validate(objectOrSchemaName: Object|string, objectOrValidationOptions: Object|ValidationOptions, maybeValidatorOptions?: ValidatorOptions): Promise { + validate(objectOrSchemaName: object|string, objectOrValidationOptions: object|ValidationOptions, maybeValidatorOptions?: ValidatorOptions): Promise { return this.coreValidate(objectOrSchemaName, objectOrValidationOptions, maybeValidatorOptions); } /** * Performs validation of the given object based on decorators used in given object class and reject on error. */ - validateOrReject(object: Object, options?: ValidatorOptions): Promise; + validateOrReject(object: object, options?: ValidatorOptions): Promise; /** * Performs validation of the given object based on validation schema and reject on error. */ - validateOrReject(schemaName: string, object: Object, options?: ValidatorOptions): Promise; + validateOrReject(schemaName: string, object: object, options?: ValidatorOptions): Promise; /** * Performs validation of the given object based on decorators or validation schema and reject on error. */ - async validateOrReject(objectOrSchemaName: Object|string, objectOrValidationOptions: Object|ValidationOptions, maybeValidatorOptions?: ValidatorOptions): Promise { + async validateOrReject(objectOrSchemaName: object|string, objectOrValidationOptions: object|ValidationOptions, maybeValidatorOptions?: ValidatorOptions): Promise { const errors = await this.coreValidate(objectOrSchemaName, objectOrValidationOptions, maybeValidatorOptions); if (errors.length) return Promise.reject(errors); @@ -78,20 +54,20 @@ export class Validator { * Performs validation of the given object based on decorators used in given object class. * NOTE: This method completely ignores all async validations. */ - validateSync(object: Object, options?: ValidatorOptions): ValidationError[]; + validateSync(object: object, options?: ValidatorOptions): ValidationError[]; /** * Performs validation of the given object based on validation schema. */ - validateSync(schemaName: string, object: Object, options?: ValidatorOptions): ValidationError[]; + validateSync(schemaName: string, object: object, options?: ValidatorOptions): ValidationError[]; /** * Performs validation of the given object based on decorators or validation schema. */ - validateSync(objectOrSchemaName: Object|string, objectOrValidationOptions: Object|ValidationOptions, maybeValidatorOptions?: ValidatorOptions): ValidationError[] { - const object = typeof objectOrSchemaName === "string" ? objectOrValidationOptions as Object : objectOrSchemaName as Object; + validateSync(objectOrSchemaName: object|string, objectOrValidationOptions: object|ValidationOptions, maybeValidatorOptions?: ValidatorOptions): ValidationError[] { + const object = typeof objectOrSchemaName === "string" ? objectOrValidationOptions as object : objectOrSchemaName; const options = typeof objectOrSchemaName === "string" ? maybeValidatorOptions : objectOrValidationOptions as ValidationOptions; - const schema = typeof objectOrSchemaName === "string" ? objectOrSchemaName as string : undefined; + const schema = typeof objectOrSchemaName === "string" ? objectOrSchemaName : undefined; const executor = new ValidationExecutor(this, options); executor.ignoreAsyncValidations = true; @@ -100,4 +76,24 @@ export class Validator { return executor.stripEmptyErrors(validationErrors); } + // ------------------------------------------------------------------------- + // Private Properties + // ------------------------------------------------------------------------- + /** + * Performs validation of the given object based on decorators or validation schema. + * Common method for `validateOrReject` and `validate` methods. + */ + private coreValidate(objectOrSchemaName: object|string, objectOrValidationOptions: object|ValidationOptions, maybeValidatorOptions?: ValidatorOptions): Promise { + const object = typeof objectOrSchemaName === "string" ? objectOrValidationOptions as object : objectOrSchemaName; + const options = typeof objectOrSchemaName === "string" ? maybeValidatorOptions : objectOrValidationOptions as ValidationOptions; + const schema = typeof objectOrSchemaName === "string" ? objectOrSchemaName : undefined; + + const executor = new ValidationExecutor(this, options); + const validationErrors: ValidationError[] = []; + executor.execute(object, schema, validationErrors); + + return Promise.all(executor.awaitingPromises).then(() => { + return executor.stripEmptyErrors(validationErrors); + }); + } } diff --git a/test/functional/custom-decorators.spec.ts b/test/functional/custom-decorators.spec.ts index b674f6fecb..2af65c5a53 100644 --- a/test/functional/custom-decorators.spec.ts +++ b/test/functional/custom-decorators.spec.ts @@ -9,7 +9,7 @@ const validator = new Validator(); describe("decorator with inline validation", () => { function IsLongerThan(property: string, validationOptions?: ValidationOptions) { - return function(object: Record, propertyName: string): void { + return function(object: object, propertyName: string): void { registerDecorator({ target: object.constructor, propertyName: propertyName, @@ -108,7 +108,7 @@ describe("decorator with inline validation", () => { describe("decorator with default message", () => { function IsLonger(property: string, validationOptions?: ValidationOptions) { - return function(object: Record, propertyName: string): void { + return function(object: object, propertyName: string): void { registerDecorator({ target: object.constructor, propertyName: propertyName, @@ -188,7 +188,7 @@ describe("decorator with separate validation constraint class", () => { } function IsShorterThan(property: string, validationOptions?: ValidationOptions) { - return function(object: Record, propertyName: string): void { + return function(object: object, propertyName: string): void { registerDecorator({ target: object.constructor, propertyName: propertyName, diff --git a/test/functional/sync-validation.spec.ts b/test/functional/sync-validation.spec.ts index 76f856080d..76a5e4e608 100644 --- a/test/functional/sync-validation.spec.ts +++ b/test/functional/sync-validation.spec.ts @@ -16,7 +16,7 @@ describe("sync validation should ignore async validation constraints", () => { } function IsLonger(property: string, validationOptions?: ValidationOptions) { - return function(object: Record, propertyName: string): void { + return function(object: object, propertyName: string): void { registerDecorator({ target: object.constructor, propertyName: propertyName, diff --git a/test/functional/validation-functions-and-decorators.spec.ts b/test/functional/validation-functions-and-decorators.spec.ts index f91c62f3fb..826d8f2ce2 100644 --- a/test/functional/validation-functions-and-decorators.spec.ts +++ b/test/functional/validation-functions-and-decorators.spec.ts @@ -1516,7 +1516,9 @@ describe("IsDecimal", () => { ]; const isDecimalOptions: ValidatorJS.IsDecimalOptions = { + // eslint-disable-next-line @typescript-eslint/camelcase force_decimal: true, + // eslint-disable-next-line @typescript-eslint/camelcase decimal_digits: "1", locale: "en-US" }; @@ -3436,6 +3438,7 @@ describe("IsUrl", () => { }); it("should pass on localhost with require_tld option", () => { + // eslint-disable-next-line @typescript-eslint/camelcase expect(isURL("http://localhost:3000/", {require_tld: false})).toBeTruthy(); }); @@ -4178,6 +4181,7 @@ describe("IsISSN", () => { }); describe("IsISSN with options", () => { + // eslint-disable-next-line @typescript-eslint/camelcase const options = {case_sensitive: true, require_hyphen: true}; const validValues = [ "2434-561X", diff --git a/test/functional/validation-options.spec.ts b/test/functional/validation-options.spec.ts index 8602d6503e..60932ecc9a 100644 --- a/test/functional/validation-options.spec.ts +++ b/test/functional/validation-options.spec.ts @@ -915,7 +915,7 @@ describe("context", () => { it("should map context", () => { function IsLongerThan(property: string, validationOptions?: ValidationOptions) { - return function(object: Record, propertyName: string): void { + return function(object: object, propertyName: string): void { registerDecorator({ target: object.constructor, propertyName: propertyName, diff --git a/tslint.json b/tslint.json deleted file mode 100644 index 2186f83007..0000000000 --- a/tslint.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "rules": { - "class-name": true, - "comment-format": [ - true, - "check-space" - ], - "indent": [ - true, - "spaces" - ], - "no-duplicate-variable": true, - "no-eval": true, - "no-internal-module": true, - "no-var-keyword": true, - "one-line": [ - true, - "check-open-brace", - "check-whitespace" - ], - "quotemark": [ - true, - "double" - ], - "semicolon": true, - "triple-equals": [ - true, - "allow-null-check" - ], - "typedef-whitespace": [ - true, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - } - ], - "variable-name": [ - true, - "ban-keywords" - ], - "whitespace": [ - true, - "check-branch", - "check-decl", - "check-operator", - "check-separator", - "check-type" - ] - } -} \ No newline at end of file