From ffc146c84f1ce189e0237ca6f7b1ae4266c2c79a Mon Sep 17 00:00:00 2001 From: Christian Murphy Date: Wed, 9 Aug 2023 06:37:29 -0700 Subject: [PATCH] Update `typescript` Closes GH-216. Reviewed-by: Remco Haszing Reviewed-by: Titus Wormer --- package.json | 2 +- test/process.js | 8 ++++++++ test/run.js | 12 ++++++++++++ test/use.js | 28 ++++++++++++++++++++-------- tsconfig.json | 3 --- 5 files changed, 41 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index b4a84fef..7f51f052 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "remark-preset-wooorm": "^9.0.0", "tsd": "^0.24.0", "type-coverage": "^2.0.0", - "typescript": "^4.0.0", + "typescript": "^5.0.0", "xo": "^0.54.0" }, "scripts": { diff --git a/test/process.js b/test/process.js index af61ef2f..cdf485e6 100644 --- a/test/process.js +++ b/test/process.js @@ -47,6 +47,10 @@ test('process(file, done)', () => { }) .use( () => + /** + * @param {Node} tree + * @param {VFile} file + */ function (tree, file) { assert.equal(tree, givenNode, 'should pass `tree` to transformers') assert.equal(file, givenFile, 'should pass `file` to transformers') @@ -100,6 +104,10 @@ test('process(file)', () => { }) .use( () => + /** + * @param {Node} tree + * @param {VFile} file + */ function (tree, file) { assert.equal(tree, givenNode, 'should pass `tree` to transformers') assert.equal(file, givenFile, 'should pass `file` to transformers') diff --git a/test/run.js b/test/run.js index 45f0284d..2a1568a1 100644 --- a/test/run.js +++ b/test/run.js @@ -1,3 +1,7 @@ +/** + * @typedef {import('unist').Node} Node + */ + import process from 'node:process' import assert from 'node:assert/strict' import test from 'node:test' @@ -549,6 +553,10 @@ test('runSync(node[, file])', async () => { unified() .use( () => + /** + * @param {Node} tree + * @param {VFile} file + */ function (tree, file) { assert.equal(tree, givenNode, 'passes given tree to transformers') assert.equal(file, givenFile, 'passes given file to transformers') @@ -559,6 +567,10 @@ test('runSync(node[, file])', async () => { unified() .use( () => + /** + * @param {Node} _ + * @param {VFile} file + */ function (_, file) { assert.equal( file.toString(), diff --git a/test/use.js b/test/use.js index ffb2968b..41c580f3 100644 --- a/test/use.js +++ b/test/use.js @@ -1,3 +1,8 @@ +/** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile + */ + import assert from 'node:assert/strict' import test from 'node:test' import {unified} from '../index.js' @@ -252,14 +257,21 @@ test('use(plugin[, options])', async (t) => { const condition = true processor - .use(() => (node, file) => { - assert.equal(node, givenNode, 'should attach a transformer (#1)') - assert.ok('message' in file, 'should attach a transformer (#2)') - - if (condition) { - throw new Error('Alpha bravo charlie') - } - }) + .use( + () => + /** + * @param {Node} node + * @param {VFile} file + */ + function (node, file) { + assert.equal(node, givenNode, 'should attach a transformer (#1)') + assert.ok('message' in file, 'should attach a transformer (#2)') + + if (condition) { + throw new Error('Alpha bravo charlie') + } + } + ) .freeze() assert.throws( diff --git a/tsconfig.json b/tsconfig.json index 38a7e9be..80ce6dd3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,11 +6,8 @@ "declaration": true, "emitDeclarationOnly": true, "exactOptionalPropertyTypes": true, - "forceConsistentCasingInFileNames": true, "lib": ["es2020"], "module": "node16", - "newLine": "lf", - "skipLibCheck": true, "strict": true, "target": "es2020" }