Skip to content

Commit 478484c

Browse files
committed
Update tsconfig.json
1 parent 5f572de commit 478484c

File tree

3 files changed

+32
-17
lines changed

3 files changed

+32
-17
lines changed

build.js

+16-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@
44
import fs from 'node:fs'
55
import path from 'node:path'
66
import regenerate from 'regenerate'
7-
import idStart from '@unicode/unicode-15.0.0/Binary_Property/ID_Start/code-points.js'
8-
import idCont from '@unicode/unicode-15.0.0/Binary_Property/ID_Continue/code-points.js'
7+
// @ts-expect-error untyped.
8+
import idStart_ from '@unicode/unicode-15.0.0/Binary_Property/ID_Start/code-points.js'
9+
/** @type {Array<number>} */
10+
// @ts-expect-error untyped.
11+
import idCont_ from '@unicode/unicode-15.0.0/Binary_Property/ID_Continue/code-points.js'
12+
13+
const idStart = /** @type {Array<number>} */ (idStart_)
14+
const idCont = /** @type {Array<number>} */ (idCont_)
915

1016
const start = [36 /* `$` */, 95 /* `_` */].concat(idStart.filter((d) => bmp(d)))
1117
const cont = [0x20_0c, 0x20_0d].concat(idCont.filter((d) => bmp(d)))
@@ -23,6 +29,14 @@ fs.writeFileSync(
2329
].join('\n')
2430
)
2531

32+
/**
33+
* Check if `code` is BMP.
34+
*
35+
* @param {number} code
36+
* Character code.
37+
* @returns {boolean}
38+
* Whether `code` is BMP.
39+
*/
2640
function bmp(code) {
2741
return code <= 0xff_ff /* BMP */
2842
}

package.json

+7-8
Original file line numberDiff line numberDiff line change
@@ -33,28 +33,27 @@
3333
"regex.js"
3434
],
3535
"devDependencies": {
36+
"@types/regenerate": "^1.0.0",
3637
"@types/tape": "^4.0.0",
3738
"@unicode/unicode-15.0.0": "^1.0.0",
3839
"c8": "^7.6.0",
39-
"nyc": "^15.0.0",
4040
"prettier": "^2.0.0",
4141
"regenerate": "^1.0.0",
4242
"remark-cli": "^11.0.0",
4343
"remark-preset-wooorm": "^9.0.0",
44-
"rimraf": "^3.0.0",
4544
"tape": "^5.0.0",
4645
"type-coverage": "^2.0.0",
4746
"typescript": "^4.0.0",
4847
"xo": "^0.53.0"
4948
},
5049
"scripts": {
51-
"build": "rimraf \"*.d.ts\" && tsc && type-coverage",
52-
"generate": "node build",
50+
"prepack": "npm run build && npm run format",
51+
"generate": "node --conditions development build.js",
52+
"build": "tsc --build --clean && tsc --build && type-coverage",
5353
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
54-
"test-api": "node test.js",
55-
"test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node test.js",
56-
"test": "npm run generate && npm run build && npm run format && npm run test-coverage",
57-
"prepack": "npm run build && npm run format"
54+
"test-api": "node --conditions development test.js",
55+
"test-coverage": "c8 --check-coverage --100 --reporter lcov npm run test-api",
56+
"test": "npm run generate && npm run build && npm run format && npm run test-coverage"
5857
},
5958
"prettier": {
6059
"tabWidth": 2,

tsconfig.json

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
{
2-
"files": ["index.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,
8+
"exactOptionalPropertyTypes": true,
9+
"forceConsistentCasingInFileNames": true,
10+
"lib": ["es2020"],
11+
"module": "node16",
12+
"newLine": "lf",
1213
"skipLibCheck": true,
13-
"strict": true
14+
"strict": true,
15+
"target": "es2020"
1416
}
1517
}

0 commit comments

Comments
 (0)