Skip to content

Commit 95a1eed

Browse files
committed
Use strict types
1 parent 8969b35 commit 95a1eed

File tree

4 files changed

+24
-11
lines changed

4 files changed

+24
-11
lines changed

build.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,16 @@ function onconcat(buf) {
4949
if (count === urls.length) {
5050
fs.writeFile(
5151
'index.js',
52-
'export const svgTagNames = ' +
53-
JSON.stringify(svgTagNames.sort(), null, 2) +
54-
'\n',
52+
[
53+
'/**',
54+
' * List of known SVG tag names.',
55+
' *',
56+
' * @type {Array<string>}',
57+
' */',
58+
'export const svgTagNames = ' +
59+
JSON.stringify(svgTagNames.sort(), null, 2),
60+
''
61+
].join('\n'),
5562
bail
5663
)
5764
}

index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* List of known SVG tag names.
3+
*
4+
* @type {Array<string>}
5+
*/
16
export const svgTagNames = [
27
'a',
38
'altGlyph',

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@
5050
"xo": "^0.46.0"
5151
},
5252
"scripts": {
53-
"prepack": "npm run build && npm run format",
54-
"build": "rimraf \"*.d.ts\" && tsc && type-coverage",
5553
"generate": "node build",
54+
"prepublishOnly": "npm run build && npm run format",
55+
"build": "rimraf \"*.d.ts\" && tsc && type-coverage",
5656
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
57-
"test-api": "node test.js",
58-
"test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node test.js",
59-
"test": "npm run build && npm run format && npm run test-coverage"
57+
"test-api": "node --conditions development test.js",
58+
"test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov npm run test-api",
59+
"test": "npm run generate && npm run build && npm run format && npm run test-coverage"
6060
},
6161
"prettier": {
6262
"tabWidth": 2,
@@ -77,6 +77,7 @@
7777
"typeCoverage": {
7878
"atLeast": 100,
7979
"detail": true,
80-
"strict": true
80+
"strict": true,
81+
"ignoreCatch": true
8182
}
8283
}

tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"files": ["index.js"],
32
"include": ["*.js"],
43
"compilerOptions": {
54
"target": "ES2020",
@@ -11,6 +10,7 @@
1110
"declaration": true,
1211
"emitDeclarationOnly": true,
1312
"allowSyntheticDefaultImports": true,
14-
"skipLibCheck": true
13+
"skipLibCheck": true,
14+
"strict": true
1515
}
1616
}

0 commit comments

Comments
 (0)