Skip to content

Commit cf1d4a1

Browse files
committed
Update tsconfig.json
1 parent 137db5a commit cf1d4a1

File tree

3 files changed

+49
-23
lines changed

3 files changed

+49
-23
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,17 @@
5454
"prettier": "^2.0.0",
5555
"remark-cli": "^11.0.0",
5656
"remark-preset-wooorm": "^9.0.0",
57-
"rimraf": "^3.0.0",
5857
"tape": "^5.0.0",
5958
"type-coverage": "^2.0.0",
6059
"typescript": "^4.0.0",
6160
"xo": "^0.53.0"
6261
},
6362
"scripts": {
64-
"build": "rimraf \"*.d.ts\" && tsc && type-coverage",
63+
"prepack": "npm run build && npm run format",
64+
"build": "tsc --build --clean && tsc --build && type-coverage",
6565
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
6666
"test-api": "node --conditions development test/index.js",
67-
"test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node --conditions development test/index.js",
67+
"test-coverage": "c8 --check-coverage --100 --reporter lcov npm run test-api",
6868
"test": "npm run build && npm run format && npm run test-coverage"
6969
},
7070
"prettier": {

test/index.js

Lines changed: 37 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import assert from 'node:assert/strict'
12
import fs from 'node:fs'
23
import path from 'node:path'
34
import test from 'tape'
@@ -248,7 +249,7 @@ test('mdast -> markdown', (t) => {
248249

249250
t.deepEqual(
250251
toMarkdown(
251-
{type: 'definition', label: 'http://a'},
252+
{type: 'definition', label: 'http://a', identifier: '', url: ''},
252253
{extensions: [gfmAutolinkLiteralToMarkdown]}
253254
),
254255
'[http://a]: <>\n',
@@ -263,6 +264,8 @@ test('mdast -> markdown', (t) => {
263264
{
264265
type: 'linkReference',
265266
label: 'http://a',
267+
identifier: '',
268+
referenceType: 'collapsed',
266269
children: [{type: 'text', value: 'http://a'}]
267270
}
268271
]
@@ -281,6 +284,8 @@ test('mdast -> markdown', (t) => {
281284
{
282285
type: 'linkReference',
283286
label: 'a',
287+
identifier: '',
288+
referenceType: 'full',
284289
children: [{type: 'text', value: 'http://a'}]
285290
}
286291
]
@@ -299,6 +304,8 @@ test('mdast -> markdown', (t) => {
299304
{
300305
type: 'linkReference',
301306
label: 'http://a',
307+
identifier: '',
308+
referenceType: 'full',
302309
children: [{type: 'text', value: 'a'}]
303310
}
304311
]
@@ -331,7 +338,15 @@ test('mdast -> markdown', (t) => {
331338
toMarkdown(
332339
{
333340
type: 'paragraph',
334-
children: [{type: 'imageReference', label: 'http://a', alt: 'a'}]
341+
children: [
342+
{
343+
type: 'imageReference',
344+
label: 'http://a',
345+
identifier: '',
346+
referenceType: 'full',
347+
alt: 'a'
348+
}
349+
]
335350
},
336351
{extensions: [gfmAutolinkLiteralToMarkdown]}
337352
),
@@ -343,7 +358,15 @@ test('mdast -> markdown', (t) => {
343358
toMarkdown(
344359
{
345360
type: 'paragraph',
346-
children: [{type: 'imageReference', label: 'a', alt: 'http://a'}]
361+
children: [
362+
{
363+
type: 'imageReference',
364+
label: 'a',
365+
identifier: '',
366+
referenceType: 'full',
367+
alt: 'http://a'
368+
}
369+
]
347370
},
348371
{extensions: [gfmAutolinkLiteralToMarkdown]}
349372
),
@@ -369,16 +392,18 @@ test('mdast -> markdown', (t) => {
369392
while (++index < files.length) {
370393
const d = files[index]
371394
const stem = path.basename(d, '.md')
372-
let actual = toHtml(
373-
toHast(
374-
fromMarkdown(fs.readFileSync(path.join('test', d)), {
375-
extensions: [gfmAutolinkLiteral],
376-
mdastExtensions: [gfmAutolinkLiteralFromMarkdown]
377-
}),
378-
{allowDangerousHtml: true}
379-
),
380-
{allowDangerousHtml: true, entities: {useNamedReferences: true}}
395+
const hast = toHast(
396+
fromMarkdown(fs.readFileSync(path.join('test', d)), {
397+
extensions: [gfmAutolinkLiteral],
398+
mdastExtensions: [gfmAutolinkLiteralFromMarkdown]
399+
}),
400+
{allowDangerousHtml: true}
381401
)
402+
assert(hast && hast.type === 'root', 'expected root')
403+
let actual = toHtml(hast, {
404+
allowDangerousHtml: true,
405+
entities: {useNamedReferences: true}
406+
})
382407
const expected = String(fs.readFileSync(path.join('test', stem + '.html')))
383408

384409
if (actual.charCodeAt(actual.length - 1) !== 10) {

tsconfig.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
{
2-
"include": ["*.js"],
2+
"include": ["**/*.js"],
3+
"exclude": ["coverage/", "node_modules/"],
34
"compilerOptions": {
4-
"target": "ES2020",
5-
"lib": ["ES2020"],
6-
"module": "ES2020",
7-
"moduleResolution": "node",
8-
"allowJs": true,
95
"checkJs": true,
106
"declaration": true,
117
"emitDeclarationOnly": true,
12-
"allowSyntheticDefaultImports": true,
8+
"exactOptionalPropertyTypes": true,
9+
"forceConsistentCasingInFileNames": true,
10+
"lib": ["es2020"],
11+
"module": "node16",
12+
"newLine": "lf",
1313
"skipLibCheck": true,
14-
"strict": true
14+
"strict": true,
15+
"target": "es2020"
1516
}
1617
}

0 commit comments

Comments
 (0)