diff --git a/package.json b/package.json index 9d40bf6..ad5212e 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "docs": "typedoc source/index.ts", "build": "del-cli dist && tsc", "prepare": "npm run build", - "//postpublish": "npm run docs && gh-pages --dist docs --no-history --message \"Deploy documentation\"", + "postpublish": "npm run docs && gh-pages --dist docs --no-history --message \"Deploy documentation\"", "example": "npm run build && node example.js" }, "files": [ @@ -49,7 +49,7 @@ "object" ], "dependencies": { - "@sindresorhus/is": "^4.6.0", + "@sindresorhus/is": "^5.0.1", "callsites": "^4.0.0", "dot-prop": "^7.2.0", "lodash.isequal": "^4.5.0", @@ -59,25 +59,23 @@ "devDependencies": { "@sindresorhus/tsconfig": "^3.0.1", "@types/lodash.isequal": "^4.5.6", - "@types/node": "^17.0.36", + "@types/node": "^17.0.42", "@types/vali-date": "^1.0.0", - "ava": "^4.2.0", + "ava": "^4.3.0", "c8": "^7.11.3", "del-cli": "^4.0.1", "expect-type": "^0.13.0", "gh-pages": "^4.0.0", - "ts-node": "^10.8.0", - "typescript": "^4.7.2", - "xo": "^0.49.0" + "ts-node": "^10.8.1", + "typedoc": "^0.22.17", + "typescript": "^4.7.3", + "xo": "^0.50.0" }, "browser": { "./dist/utils/infer-label.js": "./dist/utils/infer-label.browser.js" }, "sideEffects": false, "xo": { - "parserOptions": { - "project": "./tsconfig.xo.json" - }, "ignores": [ "example.js", "dev-only.js", @@ -95,17 +93,16 @@ } }, "ava": { - "nodeArguments": [ - "--loader=ts-node/esm", - "--experimental-specifier-resolution=node" - ], "files": [ "test/**", "!test/fixtures/**" ], "extensions": { "ts": "module" - } + }, + "nodeArguments": [ + "--loader=ts-node/esm" + ] }, "c8": { "reporter": [ diff --git a/source/index.ts b/source/index.ts index 5eb8175..0cc33d1 100644 --- a/source/index.ts +++ b/source/index.ts @@ -116,7 +116,7 @@ const ow = (value: unknown, labelOrPredicate: unknown, predicate?: BasePredic Object.defineProperties(ow, { isValid: { - value(value: unknown, predicate: BasePredicate): boolean { + value(value: unknown, predicate: BasePredicate): boolean { try { test(value, '', predicate); return true; diff --git a/source/predicates/error.ts b/source/predicates/error.ts index db5e3f0..f802009 100644 --- a/source/predicates/error.ts +++ b/source/predicates/error.ts @@ -25,7 +25,7 @@ export class ErrorPredicate extends Predicate { @param expected - Expected message of the Error. */ - message(expected: string): this { + override message(expected: string): this { return this.addValidator({ message: (error, label) => `Expected ${label} message to be \`${expected}\`, got \`${error.message}\``, validator: error => error.message === expected, diff --git a/source/utils/infer-label.ts b/source/utils/infer-label.ts index ccc37ed..f1fc6b3 100644 --- a/source/utils/infer-label.ts +++ b/source/utils/infer-label.ts @@ -51,14 +51,13 @@ export const inferLabel = (callsites: readonly CallSite[]): void | string => { line = line.slice(columnNumber - 1); const match = labelRegex.exec(line); + const token = match?.groups?.['label']; - if (!match?.groups?.label) { + if (!token) { // Exit if we didn't find a label return; } - const token = match.groups.label; - if (isValidIdentifier(token) || isValidIdentifier(token.split('.').pop())) { return token; } diff --git a/source/utils/node/is-node.ts b/source/utils/node/is-node.ts index 7bc54a9..5c50d17 100644 --- a/source/utils/node/is-node.ts +++ b/source/utils/node/is-node.ts @@ -1,2 +1,2 @@ -// eslint-disable-next-line node/prefer-global/process +// eslint-disable-next-line n/prefer-global/process export default Boolean(process?.versions?.node); diff --git a/tsconfig.json b/tsconfig.json index c489a60..261b545 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,6 +6,11 @@ "include": [ "source" ], + "ts-node": { + "transpileOnly": true, + "files": true, + "experimentalResolver": true + }, "typedocOptions": { "out": "docs", "excludePrivate": true, diff --git a/tsconfig.xo.json b/tsconfig.xo.json deleted file mode 100644 index b01049f..0000000 --- a/tsconfig.xo.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.json", - "include": [ - "test" - ] -}