Skip to content

Commit

Permalink
Update dev-dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Nov 1, 2021
1 parent 7183884 commit 1a58aea
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 46 deletions.
42 changes: 19 additions & 23 deletions build.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
import fs from 'fs'
import https from 'https'
import fs from 'node:fs'
import https from 'node:https'
import concat from 'concat-stream'
import {bail} from 'bail'
import unified from 'unified'
import {unified} from 'unified'
import html from 'rehype-parse'
// @ts-ignore
import q from 'hast-util-select'
// @ts-ignore
import toString from 'hast-util-to-string'
import {selectAll} from 'hast-util-select'
import {toString} from 'hast-util-to-string'
import {htmlElementAttributes} from './index.js'

var processor = unified().use(html)
const processor = unified().use(html)

// Global attributes.
var globals = htmlElementAttributes['*']
let globals = htmlElementAttributes['*']

if (!globals) {
globals = []
Expand All @@ -33,25 +31,23 @@ function onhtml(response) {
* @param {Buffer} buf
*/
function onconcat(buf) {
var nodes = q.selectAll('#attributes-1 tbody tr', processor.parse(buf))
var index = -1
var result = {}
/** @type {string[]} */
var keys
const nodes = selectAll('#attributes-1 tbody tr', processor.parse(buf))
let index = -1
const result = {}
/** @type {string} */
var key
let key
/** @type {string} */
var name
let name
/** @type {string} */
var value
let value
/** @type {string[]} */
var elements
let elements
/** @type {string} */
var tagName
let tagName
/** @type {string[]} */
var attributes
let attributes
/** @type {number} */
var offset
let offset

// Throw if we didn’t match, e.g., when the spec updates.
if (nodes.length === 0) {
Expand Down Expand Up @@ -83,7 +79,7 @@ function onhtml(response) {
}
}

keys = Object.keys(htmlElementAttributes).sort()
const keys = Object.keys(htmlElementAttributes).sort()
index = -1

while (++index < keys.length) {
Expand All @@ -103,7 +99,7 @@ function onhtml(response) {

fs.writeFile(
'index.js',
'export var htmlElementAttributes = ' +
'export const htmlElementAttributes = ' +
JSON.stringify(result, null, 2) +
'\n',
bail
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export var htmlElementAttributes = {
export const htmlElementAttributes = {
'*': [
'accesskey',
'autocapitalize',
Expand Down
23 changes: 9 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,23 @@
],
"devDependencies": {
"@types/concat-stream": "^1.6.0",
"@types/node": "^14.14.36",
"@types/node": "^16.0.0",
"@types/tape": "^4.0.0",
"bail": "^2.0.0",
"c8": "^7.0.0",
"concat-stream": "^2.0.0",
"hast-util-select": "^4.0.0",
"hast-util-to-string": "^1.0.0",
"hast-util-select": "^5.0.0",
"hast-util-to-string": "^2.0.0",
"prettier": "^2.0.0",
"rehype-parse": "^7.0.0",
"remark-cli": "^9.0.0",
"remark-preset-wooorm": "^8.0.0",
"rehype-parse": "^8.0.0",
"remark-cli": "^10.0.0",
"remark-preset-wooorm": "^9.0.0",
"rimraf": "^3.0.0",
"tape": "^5.0.0",
"type-coverage": "^2.0.0",
"typescript": "^4.0.0",
"unified": "^9.0.0",
"xo": "^0.38.0"
"unified": "^10.0.0",
"xo": "^0.46.0"
},
"scripts": {
"prepack": "npm run build && npm run format",
Expand All @@ -69,12 +69,7 @@
"trailingComma": "none"
},
"xo": {
"prettier": true,
"rules": {
"import/no-mutable-exports": "off",
"no-var": "off",
"prefer-arrow-callback": "off"
}
"prettier": true
},
"remarkConfig": {
"plugins": [
Expand Down
16 changes: 8 additions & 8 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import assert from 'assert'
import assert from 'node:assert'
import test from 'tape'
import {htmlElementAttributes} from './index.js'

var own = {}.hasOwnProperty
const own = {}.hasOwnProperty

test('htmlElementAttributes', function (t) {
t.equal(typeof htmlElementAttributes, 'object', 'should be an `object`')

t.doesNotThrow(function () {
/** @type {string} */
var key
let key

for (key in htmlElementAttributes) {
if (own.call(htmlElementAttributes, key)) {
Expand All @@ -20,15 +20,15 @@ test('htmlElementAttributes', function (t) {

t.doesNotThrow(function () {
/** @type {string} */
var key
let key
/** @type {string[]} */
var props
let props
/** @type {number} */
var index
let index
/** @type {string} */
var prop
let prop
/** @type {string} */
var label
let label

for (key in htmlElementAttributes) {
if (own.call(htmlElementAttributes, key)) {
Expand Down

0 comments on commit 1a58aea

Please sign in to comment.