Skip to content

Commit

Permalink
Use strict types
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Nov 1, 2021
1 parent 4683d90 commit 1f8c8ff
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 deletions.
16 changes: 12 additions & 4 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ function onwhatwg(response) {
let index = -1

while (++index < nodes.length) {
const id = String(nodes[index].properties.id || '')
const node = nodes[index]
const id = String((node.properties || {}).id || '')
const data = toString(nodes[index])

if (
Expand All @@ -79,9 +80,16 @@ function done() {
if (count === 2) {
fs.writeFile(
'index.js',
'export const htmlTagNames = ' +
JSON.stringify(htmlTagNames.sort(), null, 2) +
'\n',
[
'/**',
' * List of known HTML tag names.',
' *',
' * @type {Array<string>}',
' */',
'export const htmlTagNames = ' +
JSON.stringify(htmlTagNames.sort(), null, 2),
''
].join('\n'),
bail
)
}
Expand Down
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* List of known HTML tag names.
*
* @type {Array<string>}
*/
export const htmlTagNames = [
'a',
'abbr',
Expand Down
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@
"xo": "^0.46.0"
},
"scripts": {
"prepack": "npm run build && npm run format",
"build": "rimraf \"*.d.ts\" && tsc && type-coverage",
"generate": "node build",
"prepublishOnly": "npm run build && npm run format",
"build": "rimraf \"*.d.ts\" && tsc && type-coverage",
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
"test-api": "node test.js",
"test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node test.js",
"test": "npm run build && npm run format && npm run test-coverage"
"test-api": "node --conditions development test.js",
"test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov npm run test-api",
"test": "npm run generate && npm run build && npm run format && npm run test-coverage"
},
"prettier": {
"tabWidth": 2,
Expand All @@ -79,6 +79,7 @@
"typeCoverage": {
"atLeast": 100,
"detail": true,
"strict": true
"strict": true,
"ignoreCatch": true
}
}
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"files": ["index.js"],
"include": ["*.js"],
"compilerOptions": {
"target": "ES2020",
Expand All @@ -11,6 +10,7 @@
"declaration": true,
"emitDeclarationOnly": true,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true
"skipLibCheck": true,
"strict": true
}
}

0 comments on commit 1f8c8ff

Please sign in to comment.