Skip to content

Commit 43677f3

Browse files
committed
Update tsconfig.json
1 parent 260cd39 commit 43677f3

File tree

4 files changed

+19
-14
lines changed

4 files changed

+19
-14
lines changed

lib/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,14 @@ import {
6262
import {whitespace} from 'hast-util-whitespace'
6363
import {html, svg, find, hastToReact} from 'property-information'
6464
import {stringify as spaces} from 'space-separated-tokens'
65-
import style from 'style-to-object'
65+
// @ts-expect-error: `style-to-object` doesn’t support actual ESM + TS correctly.
66+
import styleToObject from 'style-to-object'
6667
import {position} from 'unist-util-position'
6768
import {zwitch} from 'zwitch'
6869

70+
/** @type {(value: string, iterator?: (property: string, value: string, declaration: unknown) => void) => Record<string, string>} */
71+
const style = styleToObject
72+
6973
const toReact = /** @type {Record<string, string>} */ (hastToReact)
7074

7175
const own = {}.hasOwnProperty

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
"@babel/generator": "^7.0.0",
6262
"@babel/plugin-transform-react-jsx": "^7.0.0",
6363
"@types/babel__core": "^7.0.0",
64+
"@types/babel__generator": "^7.0.0",
6465
"@types/tape": "^4.0.0",
6566
"@vue/babel-plugin-jsx": "^1.0.0",
6667
"acorn-jsx": "^5.0.0",
@@ -77,7 +78,6 @@
7778
"prettier": "^2.0.0",
7879
"remark-cli": "^11.0.0",
7980
"remark-preset-wooorm": "^9.0.0",
80-
"rimraf": "^3.0.0",
8181
"tape": "^5.0.0",
8282
"type-coverage": "^2.0.0",
8383
"typescript": "^4.0.0",
@@ -86,10 +86,10 @@
8686
},
8787
"scripts": {
8888
"prepack": "npm run build && npm run format",
89-
"build": "rimraf \"lib/**/*.d.ts\" \"*.d.ts\" && tsc && type-coverage",
89+
"build": "tsc --build --clean && tsc --build && type-coverage",
9090
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
91-
"test-api": "node test.js",
92-
"test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node test.js",
91+
"test-api": "node --conditions development test.js",
92+
"test-coverage": "c8 --check-coverage --100 --reporter lcov npm run test-api",
9393
"test": "npm run build && npm run format && npm run test-coverage"
9494
},
9595
"prettier": {

test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {mdxjs} from 'micromark-extension-mdxjs'
2424
import {visit} from 'unist-util-visit'
2525
import {toEstree} from './index.js'
2626

27-
/** @type {fauxEsmGenerate} */
27+
/** @type {(value: unknown, options?: import('@babel/generator').GeneratorOptions) => {code: string}} */
2828
// @ts-expect-error Types are wrong.
2929
const generate = fauxEsmGenerate.default
3030

tsconfig.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
{
2-
"include": ["lib/**/*.js", "*.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)