Skip to content

Commit f6bd64e

Browse files
committedMay 16, 2023
Refactor tsconfigs for perf and strictness
1 parent e69e55f commit f6bd64e

File tree

13 files changed

+32
-31
lines changed

13 files changed

+32
-31
lines changed
 

‎package.json

+6-5
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
},
1212
"type": "module",
1313
"workspaces": [
14-
"packages/remark-parse",
15-
"packages/remark-stringify",
16-
"packages/remark",
17-
"packages/remark-cli"
14+
"packages/remark-parse/",
15+
"packages/remark-stringify/",
16+
"packages/remark/",
17+
"packages/remark-cli/"
1818
],
1919
"devDependencies": {
2020
"@types/mdast": "^3.0.0",
@@ -36,7 +36,8 @@
3636
"xo": "^0.54.0"
3737
},
3838
"scripts": {
39-
"build": "npm run build --workspaces && rimraf \"*.d.ts\" \"{test,script}/**/*.d.ts\" && tsc && type-coverage",
39+
"prepack": "npm run build && npm run format",
40+
"build": "tsc --build --clean && tsc --build && type-coverage",
4041
"format": "./packages/remark-cli/cli.js . -qfo && prettier . -w --loglevel warn && xo --fix",
4142
"test-api": "npm run test --workspaces && node --conditions development test/index.js",
4243
"test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov npm run test-api",

‎packages/remark-cli/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
"unified-args": "^10.0.0"
3636
},
3737
"scripts": {
38-
"build": "rimraf \"*.d.ts\" && tsc && type-coverage",
3938
"test": "node --conditions development test.js"
4039
},
4140
"xo": false,

‎packages/remark-cli/tsconfig.json

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
{
22
"extends": "../../tsconfig.json",
3-
"include": ["*.js"],
4-
"compilerOptions": {
5-
"resolveJsonModule": true
6-
}
3+
"references": [{"path": "../remark/"}]
74
}

‎packages/remark-parse/index.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type {Root} from 'mdast'
33
import type {Plugin} from 'unified'
44
import type {Options} from './lib/index.js'
55

6-
declare const remarkParse: Plugin<[Options?] | void[], string, Root>
6+
declare const remarkParse: Plugin<[(Options | undefined)?], string, Root>
77
export default remarkParse
88

99
export type {Options} from './lib/index.js'

‎packages/remark-parse/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@
4646
"unified": "^10.0.0"
4747
},
4848
"scripts": {
49-
"test": "node --conditions development test.js",
50-
"build": "rimraf \"test.d.ts\" \"lib/**/*.d.ts\" && tsc && type-coverage"
49+
"test": "node --conditions development test.js"
5150
},
5251
"xo": false,
5352
"typeCoverage": {

‎packages/remark-parse/tsconfig.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
{
2-
"extends": "../../tsconfig.json",
3-
"include": ["lib/**/*.js", "test.js"]
2+
"extends": "../../tsconfig.json"
43
}

‎packages/remark-stringify/index.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type {Root} from 'mdast'
33
import type {Plugin} from 'unified'
44
import type {Options} from './lib/index.js'
55

6-
declare const remarkStringify: Plugin<[Options?] | void[], Root, string>
6+
declare const remarkStringify: Plugin<[(Options | undefined)?], Root, string>
77
export default remarkStringify
88

99
export type {Options} from './lib/index.js'

‎packages/remark-stringify/lib/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {toMarkdown} from 'mdast-util-to-markdown'
88

99
/**
1010
* @this {import('unified').Processor}
11-
* @type {import('unified').Plugin<[Options]|void[], Node, string>}
11+
* @type {import('unified').Plugin<[Options?]|void[], Node, string>}
1212
*/
1313
export default function remarkStringify(options) {
1414
/** @type {import('unified').CompilerFunction<Node, string>} */

‎packages/remark-stringify/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@
4646
"unified": "^10.0.0"
4747
},
4848
"scripts": {
49-
"test": "node --conditions development test.js",
50-
"build": "rimraf \"test.d.ts\" \"lib/**/*.d.ts\" && tsc && type-coverage"
49+
"test": "node --conditions development test.js"
5150
},
5251
"xo": false,
5352
"typeCoverage": {
+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
{
2-
"extends": "../../tsconfig.json",
3-
"include": ["lib/**/*.js", "test.js"]
2+
"extends": "../../tsconfig.json"
43
}

‎packages/remark/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@
4444
"unified": "^10.0.0"
4545
},
4646
"scripts": {
47-
"test": "node --conditions development test.js",
48-
"build": "rimraf \"*.d.ts\" && tsc && type-coverage"
47+
"test": "node --conditions development test.js"
4948
},
5049
"xo": false,
5150
"typeCoverage": {

‎packages/remark/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"extends": "../../tsconfig.json",
3-
"include": ["*.js"]
3+
"references": [{"path": "../remark-parse/"}, {"path": "../remark-stringify/"}]
44
}

‎tsconfig.json

+16-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
{
2-
"include": ["script/**/*.js", "test/**/*.js"],
32
"compilerOptions": {
4-
"target": "es2021",
5-
"lib": ["es2021"],
6-
"module": "node16",
3+
"customConditions": ["development"],
74
"checkJs": true,
85
"declaration": true,
96
"emitDeclarationOnly": true,
10-
"skipLibCheck": true,
11-
"strict": true
12-
}
7+
"exactOptionalPropertyTypes": true,
8+
"forceConsistentCasingInFileNames": true,
9+
"lib": ["es2020"],
10+
"module": "node16",
11+
"newLine": "lf",
12+
"resolveJsonModule": true,
13+
"strict": true,
14+
"target": "es2020"
15+
},
16+
"exclude": ["**/coverage/", "**/node_modules/"],
17+
"include": [
18+
"**/*.js",
19+
"packages/remark-parse/index.d.ts",
20+
"packages/remark-stringify/index.d.ts"
21+
]
1322
}

0 commit comments

Comments
 (0)
Please sign in to comment.