Skip to content

Commit aeb2e14

Browse files
committed
Add strict to tsconfig.json
1 parent 4087976 commit aeb2e14

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

lib/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export const x =
4848

4949
if (name === undefined || name === null) {
5050
node = {type: 'root', children: []}
51-
// @ts-ignore Root builder doesn’t accept attributes.
51+
// @ts-expect-error Root builder doesn’t accept attributes.
5252
children.unshift(attributes)
5353
} else if (typeof name === 'string') {
5454
node = {type: 'element', name, attributes: {}, children: []}
@@ -65,7 +65,7 @@ export const x =
6565
(typeof attributes[key] !== 'number' ||
6666
!Number.isNaN(attributes[key]))
6767
) {
68-
// @ts-ignore Pretty sure we just set it.
68+
// @ts-expect-error Pretty sure we just set it.
6969
node.attributes[key] = String(attributes[key])
7070
}
7171
}

script/generate-jsx.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ fs.writeFileSync(
1212
path.join('test', 'jsx-build-jsx-classic.js'),
1313
generate(
1414
buildJsx(
15-
// @ts-ignore Acorn nodes are assignable to ESTree nodes.
15+
// @ts-expect-error Acorn nodes are assignable to ESTree nodes.
1616
Parser.extend(acornJsx()).parse(
1717
doc.replace(/'name'/, "'jsx (estree-util-build-jsx, classic)'"),
18-
// @ts-ignore Hush, `2021` is fine.
18+
// @ts-expect-error Hush, `2021` is fine.
1919
{sourceType: 'module', ecmaVersion: 2021}
2020
),
2121
{pragma: 'x', pragmaFrag: 'null'}
@@ -27,10 +27,10 @@ fs.writeFileSync(
2727
path.join('test', 'jsx-build-jsx-automatic.js'),
2828
generate(
2929
buildJsx(
30-
// @ts-ignore Acorn nodes are assignable to ESTree nodes.
30+
// @ts-expect-error Acorn nodes are assignable to ESTree nodes.
3131
Parser.extend(acornJsx()).parse(
3232
doc.replace(/'name'/, "'jsx (estree-util-build-jsx, automatic)'"),
33-
// @ts-ignore Hush, `2021` is fine.
33+
// @ts-expect-error Hush, `2021` is fine.
3434
{sourceType: 'module', ecmaVersion: 2021}
3535
),
3636
{runtime: 'automatic', importSource: '.'}
@@ -40,7 +40,7 @@ fs.writeFileSync(
4040

4141
fs.writeFileSync(
4242
path.join('test', 'jsx-babel-classic.js'),
43-
// @ts-ignore Result always given.
43+
// @ts-expect-error Result always given.
4444
babel.transform(doc.replace(/'name'/, "'jsx (babel, classic)'"), {
4545
plugins: [
4646
['@babel/plugin-transform-react-jsx', {pragma: 'x', pragmaFrag: 'null'}]
@@ -50,7 +50,7 @@ fs.writeFileSync(
5050

5151
fs.writeFileSync(
5252
path.join('test', 'jsx-babel-automatic.js'),
53-
// @ts-ignore Result always given.
53+
// @ts-expect-error Result always given.
5454
babel
5555
.transformSync(doc.replace(/'name'/, "'jsx (babel, automatic)'"), {
5656
plugins: [

test/core.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ test('xastscript', (t) => {
1212

1313
t.throws(
1414
() => {
15-
// @ts-ignore runtime.
15+
// @ts-expect-error runtime.
1616
x(1)
1717
},
1818
/Expected element name, got `1`/,
@@ -69,7 +69,7 @@ test('xastscript', (t) => {
6969
)
7070

7171
t.deepEqual(
72-
// @ts-ignore Deeply nested children are not typed.
72+
// @ts-expect-error Deeply nested children are not typed.
7373
x('y', {}, [[[x('a')]], [[[[x('b')]], x('c')]]]),
7474
{
7575
type: 'element',
@@ -120,7 +120,7 @@ test('xastscript', (t) => {
120120

121121
t.throws(
122122
() => {
123-
// @ts-ignore runtime.
123+
// @ts-expect-error runtime.
124124
x('y', {}, {})
125125
},
126126
/Expected node, nodes, string, got `\[object Object]`/,

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"emitDeclarationOnly": true,
2020
"allowSyntheticDefaultImports": true,
2121
"skipLibCheck": true,
22-
"strictNullChecks": true
22+
"strictNullChecks": true,
23+
"strict": true
2324
}
2425
}

0 commit comments

Comments
 (0)