Skip to content

Commit 3c78c80

Browse files
committed
Update tsconfig.json
1 parent 53c027d commit 3c78c80

File tree

3 files changed

+14
-22
lines changed

3 files changed

+14
-22
lines changed

lib/index.js

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,18 @@
11
/**
22
* @typedef {import('estree-jsx').Node} Node
3-
* @typedef {import('estree-jsx').Comment} Comment
43
* @typedef {import('estree-jsx').Expression} Expression
5-
* @typedef {import('estree-jsx').Pattern} Pattern
64
* @typedef {import('estree-jsx').ObjectExpression} ObjectExpression
75
* @typedef {import('estree-jsx').Property} Property
86
* @typedef {import('estree-jsx').ImportSpecifier} ImportSpecifier
97
* @typedef {import('estree-jsx').SpreadElement} SpreadElement
108
* @typedef {import('estree-jsx').MemberExpression} MemberExpression
119
* @typedef {import('estree-jsx').Literal} Literal
1210
* @typedef {import('estree-jsx').Identifier} Identifier
13-
* @typedef {import('estree-jsx').JSXElement} JSXElement
14-
* @typedef {import('estree-jsx').JSXFragment} JSXFragment
15-
* @typedef {import('estree-jsx').JSXText} JSXText
16-
* @typedef {import('estree-jsx').JSXExpressionContainer} JSXExpressionContainer
17-
* @typedef {import('estree-jsx').JSXEmptyExpression} JSXEmptyExpression
18-
* @typedef {import('estree-jsx').JSXSpreadChild} JSXSpreadChild
1911
* @typedef {import('estree-jsx').JSXAttribute} JSXAttribute
20-
* @typedef {import('estree-jsx').JSXSpreadAttribute} JSXSpreadAttribute
2112
* @typedef {import('estree-jsx').JSXMemberExpression} JSXMemberExpression
2213
* @typedef {import('estree-jsx').JSXNamespacedName} JSXNamespacedName
2314
* @typedef {import('estree-jsx').JSXIdentifier} JSXIdentifier
2415
*
25-
* @typedef {import('estree-walker').SyncHandler} SyncHandler
26-
*
2716
* @typedef Options
2817
* @property {'automatic'|'classic'} [runtime='classic']
2918
* @property {string} [importSource='react']
@@ -39,6 +28,7 @@
3928
* @property {string} [jsxImportSource]
4029
*/
4130

31+
// @ts-expect-error: typed incorrectly.
4232
import {walk} from 'estree-walker'
4333
import {name as isIdentifierName} from 'estree-util-is-identifier-name'
4434

@@ -58,7 +48,6 @@ export function buildJsx(tree, options = {}) {
5848
const imports = {}
5949

6050
walk(tree, {
61-
// @ts-expect-error: types are wrong.
6251
enter(/** @type {Node} */ node) {
6352
if (node.type === 'Program') {
6453
const comments = node.comments || []
@@ -107,7 +96,6 @@ export function buildJsx(tree, options = {}) {
10796
}
10897
}
10998
},
110-
// @ts-expect-error: types are wrong.
11199
// eslint-disable-next-line complexity
112100
leave(/** @type {Node} */ node) {
113101
if (node.type === 'Program') {
@@ -406,6 +394,8 @@ export function buildJsx(tree, options = {}) {
406394

407395
parameters.unshift(name)
408396

397+
// Types of `estree-walker` are wrong
398+
// type-coverage:ignore-next-line
409399
this.replace(
410400
create(node, {
411401
type: 'CallExpression',

test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import test from 'tape'
22
import {Parser} from 'acorn'
33
import jsx from 'acorn-jsx'
4+
// @ts-expect-error: typed incorrectly.
45
import {walk} from 'estree-walker'
6+
// @ts-expect-error: typed incorrectly.
57
import {generate} from 'astring'
68
import recast from 'recast'
79
import escodegen from 'escodegen'
@@ -1567,7 +1569,6 @@ function parse(doc, clean, addComments) {
15671569
return JSON.parse(JSON.stringify(tree))
15681570

15691571
/**
1570-
* @type {import('estree-walker').SyncHandler}
15711572
* @param {import('estree-jsx').Node} n
15721573
*/
15731574
function leave(n) {

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": "es2022",
5-
"lib": ["es2022"],
6-
"module": "esnext",
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)