Skip to content

Commit ab6ed77

Browse files
committed
Refactor module
Update dependencies, dev-dependencies; refactor docs; refactor code-style; remove superfluous dot-files; add note on `menuitem` controversy.
1 parent 2912061 commit ab6ed77

File tree

11 files changed

+97
-139
lines changed

11 files changed

+97
-139
lines changed

.editorconfig

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,8 @@ root = true
22

33
[*]
44
indent_style = space
5-
indent_size = 4
5+
indent_size = 2
66
end_of_line = lf
77
charset = utf-8
88
trim_trailing_whitespace = true
99
insert_final_newline = true
10-
11-
[*.{json,remarkrc,eslintrc,sh}]
12-
indent_size = 2
13-
14-
[*.md]
15-
trim_trailing_whitespace = false

.eslintignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

.eslintrc

Lines changed: 0 additions & 6 deletions
This file was deleted.

.jscs.json

Lines changed: 0 additions & 35 deletions
This file was deleted.

.remarkrc

Lines changed: 0 additions & 13 deletions
This file was deleted.

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
language: node_js
22
node_js:
3-
- '0.10'
43
- '0.11'
54
- '0.12'
65
- '4.0'
76
- '5.0'
8-
sudo: false
9-
after_script: npm install codecov.io && cat ./coverage/lcov.info | codecov
7+
- '6.0'
8+
after_success: bash <(curl -s https://codecov.io/bash)
109
deploy:
1110
- provider: npm
1211
@@ -23,3 +22,4 @@ deploy:
2322
- "html-void-elements.min.js"
2423
on:
2524
tags: true
25+
node: '6.0'

index.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,5 @@
1010

1111
/* eslint-env commonjs */
1212

13-
/*
14-
* Expose.
15-
*/
16-
13+
/* Expose. */
1714
module.exports = require('./index.json');

package.json

Lines changed: 42 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,30 +31,58 @@
3131
"bail": "^1.0.0",
3232
"browserify": "^13.0.0",
3333
"cheerio": "^0.20.0",
34-
"eslint": "^2.0.0",
35-
"esmangle": "^1.0.1",
34+
"esmangle": "^1.0.0",
3635
"istanbul": "^0.4.0",
37-
"jscs": "^2.0.0",
38-
"jscs-jsdoc": "^1.0.0",
39-
"remark": "^4.0.0",
40-
"remark-comment-config": "^3.0.0",
41-
"remark-github": "^4.0.1",
42-
"remark-lint": "^3.0.0",
43-
"remark-usage": "^3.0.0",
44-
"remark-validate-links": "^3.0.0",
45-
"tape": "^4.4.0"
36+
"remark-cli": "^1.0.0",
37+
"remark-comment-config": "^4.0.0",
38+
"remark-github": "^5.0.0",
39+
"remark-lint": "^4.0.0",
40+
"remark-usage": "^4.0.0",
41+
"remark-validate-links": "^4.0.0",
42+
"tape": "^4.0.0",
43+
"xo": "^0.16.0"
4644
},
4745
"scripts": {
4846
"build-md": "remark . --quiet --frail",
4947
"build-crawl": "node script/build.js",
5048
"build-bundle": "browserify index.js --bare -s htmlVoidElements > html-void-elements.js",
5149
"build-mangle": "esmangle html-void-elements.js > html-void-elements.min.js",
5250
"build": "npm run build-md && npm run build-bundle && npm run build-mangle",
53-
"lint-api": "eslint .",
54-
"lint-style": "jscs --reporter inline .",
55-
"lint": "npm run lint-api && npm run lint-style",
51+
"lint": "xo",
5652
"test-api": "node test.js",
5753
"test-coverage": "istanbul cover test.js",
5854
"test": "npm run build && npm run lint && npm run test-coverage"
55+
},
56+
"xo": {
57+
"space": true,
58+
"rules": {
59+
"guard-for-in": [
60+
0
61+
],
62+
"eqeqeq": [
63+
0,
64+
"allow-null"
65+
],
66+
"no-eq-null": [
67+
0
68+
]
69+
},
70+
"ignores": [
71+
"html-void-elements.js",
72+
"html-void-elements.min.js"
73+
]
74+
},
75+
"remarkConfig": {
76+
"output": true,
77+
"plugins": [
78+
"comment-config",
79+
"lint",
80+
"github",
81+
"validate-links",
82+
"usage"
83+
],
84+
"settings": {
85+
"bullet": "*"
86+
}
5987
}
6088
}

readme.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ List of known void HTML elements. Includes ancient (for example,
44
`nextid` and `basefont`) and modern (for example, `img` and
55
`meta`) tag-names from both W3C and WHATWG.
66

7+
**Note**: there’s one special case: `menuitem`. W3C specifies it to be
8+
void, but WHATWG doesn’t. I suggest using the void form.
9+
710
## Installation
811

912
[npm][]:

script/build.js

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -42,45 +42,45 @@ var output = path.join(__dirname, '..', 'index.json');
4242
* @param {Function} callback - Invoked with document.
4343
*/
4444
function load(url, callback) {
45-
var lib = url.slice(0, HTTPS.length) === HTTPS ? https : http;
46-
47-
lib.get(url, function (res, err) {
48-
var value = '';
49-
50-
if (err) {
51-
return callback(err);
52-
}
53-
54-
res
55-
.setEncoding('utf8')
56-
.on('data', function (buf) {
57-
value += buf;
58-
}).on('end', function () {
59-
return callback(null, value);
60-
});
61-
});
45+
var lib = url.slice(0, HTTPS.length) === HTTPS ? https : http;
46+
47+
lib.get(url, function (res, err) {
48+
var value = '';
49+
50+
if (err) {
51+
return callback(err);
52+
}
53+
54+
res
55+
.setEncoding('utf8')
56+
.on('data', function (buf) {
57+
value += buf;
58+
}).on('end', function () {
59+
return callback(null, value);
60+
});
61+
});
6262
}
6363

6464
/*
6565
* Crawl W3C.
6666
*/
6767

6868
load(w3c, function (err, doc) {
69-
if (err) {
70-
bail(err);
71-
}
72-
73-
cheerio.load(doc)('#void-elements')
74-
.parent()
75-
.next()
76-
.find('code a')
77-
.each(function () {
78-
var data = this.children[0].data;
79-
80-
if (data && list.indexOf(data) === -1) {
81-
list.push(data);
82-
}
83-
});
69+
if (err) {
70+
bail(err);
71+
}
72+
73+
cheerio.load(doc)('#void-elements')
74+
.parent()
75+
.next()
76+
.find('code a')
77+
.each(function () {
78+
var data = this.children[0].data;
79+
80+
if (data && list.indexOf(data) === -1) {
81+
list.push(data);
82+
}
83+
});
8484

85-
fs.writeFile(output, JSON.stringify(list.sort(), 0, 2) + '\n', bail);
85+
fs.writeFile(output, JSON.stringify(list.sort(), 0, 2) + '\n', bail);
8686
});

0 commit comments

Comments
 (0)