Skip to content

Commit f9f1c4a

Browse files
committed
Add strict to tsconfig.json
1 parent 69ef233 commit f9f1c4a

File tree

4 files changed

+11
-12
lines changed

4 files changed

+11
-12
lines changed

lib/core.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export function core(schema, defaultTagName, caseSensitive) {
6262

6363
if (selector === undefined || selector === null) {
6464
node = {type: 'root', children: []}
65-
// @ts-ignore Properties are not supported for roots.
65+
// @ts-expect-error Properties are not supported for roots.
6666
children.unshift(properties)
6767
} else {
6868
node = parseSelector(selector, defaultTagName)
@@ -79,7 +79,7 @@ export function core(schema, defaultTagName, caseSensitive) {
7979

8080
for (key in properties) {
8181
if (own.call(properties, key)) {
82-
// @ts-ignore `node.properties` is set.
82+
// @ts-expect-error `node.properties` is set.
8383
addProperty(schema, node.properties, key, properties[key])
8484
}
8585
}
@@ -183,7 +183,7 @@ function addProperty(schema, properties, key, value) {
183183
const finalResult = []
184184

185185
while (++index < result.length) {
186-
// @ts-ignore Assume no booleans in array.
186+
// @ts-expect-error Assume no booleans in array.
187187
finalResult[index] = parsePrimitive(info, info.property, result[index])
188188
}
189189

@@ -192,7 +192,7 @@ function addProperty(schema, properties, key, value) {
192192

193193
// Class names (which can be added both on the `selector` and here).
194194
if (info.property === 'className' && Array.isArray(properties.className)) {
195-
// @ts-ignore Assume no booleans in `className`.
195+
// @ts-expect-error Assume no booleans in `className`.
196196
result = properties.className.concat(result)
197197
}
198198

@@ -217,7 +217,6 @@ function addChild(nodes, value) {
217217
}
218218
} else if (typeof value === 'object' && 'type' in value) {
219219
if (value.type === 'root') {
220-
// @ts-ignore it looks like a root, TS…
221220
addChild(nodes, value.children)
222221
} else {
223222
nodes.push(value)

script/generate-jsx.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ 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)'"),
1818
{sourceType: 'module', ecmaVersion: 2021}
@@ -26,7 +26,7 @@ fs.writeFileSync(
2626
path.join('test', 'jsx-build-jsx-automatic.js'),
2727
generate(
2828
buildJsx(
29-
// @ts-ignore Acorn nodes are assignable to ESTree nodes.
29+
// @ts-expect-error Acorn nodes are assignable to ESTree nodes.
3030
Parser.extend(acornJsx()).parse(
3131
doc.replace(/'name'/, "'jsx (estree-util-build-jsx, automatic)'"),
3232
{sourceType: 'module', ecmaVersion: 2021}
@@ -38,7 +38,7 @@ fs.writeFileSync(
3838

3939
fs.writeFileSync(
4040
path.join('test', 'jsx-babel-classic.js'),
41-
// @ts-ignore Result always given.
41+
// @ts-expect-error Result always given.
4242
babel.transform(doc.replace(/'name'/, "'jsx (babel, classic)'"), {
4343
plugins: [
4444
['@babel/plugin-transform-react-jsx', {pragma: 'h', pragmaFrag: 'null'}]
@@ -48,7 +48,7 @@ fs.writeFileSync(
4848

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

test/core.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,6 @@ test('hastscript', (t) => {
845845
)
846846

847847
t.deepEqual(
848-
// @ts-ignore runtime.
849848
h('foo', {type: 'text/html', children: {bar: 'baz'}}),
850849
{
851850
type: 'element',
@@ -950,7 +949,7 @@ test('hastscript', (t) => {
950949

951950
t.throws(
952951
() => {
953-
// @ts-ignore runtime.
952+
// @ts-expect-error runtime.
954953
h('foo', {}, true)
955954
},
956955
/Expected node, nodes, or string, got `true`/,

tsconfig.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"emitDeclarationOnly": true,
2828
"allowSyntheticDefaultImports": true,
2929
"skipLibCheck": true,
30-
"strictNullChecks": true
30+
"strictNullChecks": true,
31+
"strict": true
3132
}
3233
}

0 commit comments

Comments
 (0)