From f57aff3b24946e1eaa83a2c4ef9bd00ffc06ee92 Mon Sep 17 00:00:00 2001 From: Jim Fisher Date: Thu, 26 Jan 2023 22:34:37 +0100 Subject: [PATCH 1/7] Make typechecking work with "moduleResolution": "node16" (Fixes #6) --- index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index ba9ebeb..15f6b43 100644 --- a/index.js +++ b/index.js @@ -9,9 +9,9 @@ * @typedef {import('mdast-util-to-markdown/lib/types.js').Handle} ToMarkdownHandle * @typedef {import('mdast-util-to-markdown/lib/types.js').Context} Context * @typedef {import('mdast-util-to-markdown/lib/types.js').Options} ToMarkdownExtension - * @typedef {import('./complex-types').ContainerDirective} ContainerDirective - * @typedef {import('./complex-types').LeafDirective} LeafDirective - * @typedef {import('./complex-types').TextDirective} TextDirective + * @typedef {import('./complex-types.js').ContainerDirective} ContainerDirective + * @typedef {import('./complex-types.js').LeafDirective} LeafDirective + * @typedef {import('./complex-types.js').TextDirective} TextDirective * @typedef {ContainerDirective|LeafDirective|TextDirective} Directive */ From c5f0e049829efe37ea1bc49335a4ecdd28d2f9da Mon Sep 17 00:00:00 2001 From: Jim Fisher Date: Fri, 27 Jan 2023 08:40:42 +0100 Subject: [PATCH 2/7] Use node16 module resolution --- tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index e31adf8..eacf0c4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,7 +4,7 @@ "target": "ES2020", "lib": ["ES2020"], "module": "ES2020", - "moduleResolution": "node", + "moduleResolution": "node16", "allowJs": true, "checkJs": true, "declaration": true, From ad970b414c9c35b71662dd4c6907004b3245b025 Mon Sep 17 00:00:00 2001 From: Jim Fisher Date: Sat, 28 Jan 2023 19:00:47 +0100 Subject: [PATCH 3/7] Support moduleResolution: node16 Copied changes from https://github.com/syntax-tree/mdast-util-assert/commit/8958dff406cb658abc4189568ed7af2c56d9320c --- package.json | 5 ++--- tsconfig.json | 14 +++++++------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 75d58df..82492a0 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,6 @@ "prettier": "^2.0.0", "remark-cli": "^11.0.0", "remark-preset-wooorm": "^9.0.0", - "rimraf": "^3.0.0", "tape": "^5.0.0", "type-coverage": "^2.0.0", "typescript": "^4.0.0", @@ -59,10 +58,10 @@ "xo": "^0.52.0" }, "scripts": { - "build": "rimraf \"{index,test}.d.ts\" && tsc && type-coverage", + "build": "tsc --build --clean && tsc --build && type-coverage", "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", "test-api": "node --conditions development test.js", - "test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node --conditions development test.js", + "test-coverage": "c8 --check-coverage --100 --reporter lcov npm run test-api", "test": "npm run build && npm run format && npm run test-coverage" }, "prettier": { diff --git a/tsconfig.json b/tsconfig.json index eacf0c4..0e7be28 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,16 +1,16 @@ { "include": ["*.js"], "compilerOptions": { - "target": "ES2020", - "lib": ["ES2020"], - "module": "ES2020", - "moduleResolution": "node16", - "allowJs": true, "checkJs": true, "declaration": true, "emitDeclarationOnly": true, - "allowSyntheticDefaultImports": true, + "exactOptionalPropertyTypes": true, + "forceConsistentCasingInFileNames": true, + "lib": ["es2020"], + "module": "node16", + "newLine": "lf", "skipLibCheck": true, - "strict": true + "strict": true, + "target": "es2020" } } From 3b65080ba5cbcce19c69474782bc2c0e6bce6d0a Mon Sep 17 00:00:00 2001 From: Jim Fisher Date: Sat, 28 Jan 2023 19:16:52 +0100 Subject: [PATCH 4/7] Update dependencies mentioned in TypeScript errors --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 82492a0..83db182 100644 --- a/package.json +++ b/package.json @@ -38,10 +38,10 @@ "dependencies": { "@types/mdast": "^3.0.0", "@types/unist": "^2.0.0", - "mdast-util-to-markdown": "^1.3.0", + "mdast-util-to-markdown": "^1.5.0", "parse-entities": "^4.0.0", "stringify-entities": "^4.0.0", - "unist-util-visit-parents": "^5.0.0" + "unist-util-visit-parents": "^5.1.3" }, "devDependencies": { "@types/tape": "^4.0.0", From 0acfb12a6f6c4bf80b7d99b7f8093a7f003eb7c2 Mon Sep 17 00:00:00 2001 From: Jim Fisher Date: Sat, 28 Jan 2023 19:17:48 +0100 Subject: [PATCH 5/7] attempt to fix broken references --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 15f6b43..b2137b8 100644 --- a/index.js +++ b/index.js @@ -7,7 +7,7 @@ * @typedef {import('mdast-util-from-markdown').CompileContext} CompileContext * @typedef {import('mdast-util-from-markdown').Token} Token * @typedef {import('mdast-util-to-markdown/lib/types.js').Handle} ToMarkdownHandle - * @typedef {import('mdast-util-to-markdown/lib/types.js').Context} Context + * @typedef {import('mdast-util-to-markdown/index.js').Context} Context * @typedef {import('mdast-util-to-markdown/lib/types.js').Options} ToMarkdownExtension * @typedef {import('./complex-types.js').ContainerDirective} ContainerDirective * @typedef {import('./complex-types.js').LeafDirective} LeafDirective @@ -398,7 +398,7 @@ function fence(node) { return ':'.repeat(size) - /** @type {import('unist-util-visit-parents/complex-types').BuildVisitor} */ + /** @type {import('unist-util-visit-parents/complex-types.js').BuildVisitor} */ function onvisit(_, parents) { let index = parents.length let nesting = 0 From 5183f0d1f6f5f250799502226287a0a1c414b6b1 Mon Sep 17 00:00:00 2001 From: Jim Fisher Date: Sat, 28 Jan 2023 19:45:28 +0100 Subject: [PATCH 6/7] Update index.js Co-authored-by: Remco Haszing --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index b2137b8..1d1fa4c 100644 --- a/index.js +++ b/index.js @@ -7,7 +7,7 @@ * @typedef {import('mdast-util-from-markdown').CompileContext} CompileContext * @typedef {import('mdast-util-from-markdown').Token} Token * @typedef {import('mdast-util-to-markdown/lib/types.js').Handle} ToMarkdownHandle - * @typedef {import('mdast-util-to-markdown/index.js').Context} Context + * @typedef {import('mdast-util-to-markdown').Context} Context * @typedef {import('mdast-util-to-markdown/lib/types.js').Options} ToMarkdownExtension * @typedef {import('./complex-types.js').ContainerDirective} ContainerDirective * @typedef {import('./complex-types.js').LeafDirective} LeafDirective From b46aa125345afa86b493ec8eb0e45d8b584fed90 Mon Sep 17 00:00:00 2001 From: Jim Fisher Date: Sat, 28 Jan 2023 19:46:19 +0100 Subject: [PATCH 7/7] Update index.js Co-authored-by: Remco Haszing --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 1d1fa4c..f3157e4 100644 --- a/index.js +++ b/index.js @@ -398,7 +398,7 @@ function fence(node) { return ':'.repeat(size) - /** @type {import('unist-util-visit-parents/complex-types.js').BuildVisitor} */ + /** @type {import('unist-util-visit-parents').BuildVisitor} */ function onvisit(_, parents) { let index = parents.length let nesting = 0