Skip to content

Commit 3847bcd

Browse files
committedJul 19, 2018
Refactor code-style
1 parent 06b2635 commit 3847bcd

File tree

4 files changed

+52
-38
lines changed

4 files changed

+52
-38
lines changed
 

‎.prettierignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
coverage/
2+
rehype-raw.js
3+
rehype-raw.min.js

‎index.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
'use strict';
1+
'use strict'
22

3-
var util = require('hast-util-raw');
3+
var util = require('hast-util-raw')
44

5-
module.exports = raw;
5+
module.exports = raw
66

77
function raw() {
8-
return util;
8+
return util
99
}

‎package.json

+14-6
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"browserify": "^16.0.0",
2626
"esmangle": "^1.0.0",
2727
"nyc": "^12.0.0",
28+
"prettier": "^1.13.7",
2829
"rehype-stringify": "^4.0.0",
2930
"remark-cli": "^5.0.0",
3031
"remark-parse": "^5.0.0",
@@ -35,23 +36,30 @@
3536
"xo": "^0.21.0"
3637
},
3738
"scripts": {
38-
"build-md": "remark . -qfo",
39+
"format": "remark . -qfo && prettier --write '**/*.js' && xo --fix",
3940
"build-bundle": "browserify index.js --bare -s rehypeRaw > rehype-raw.js",
4041
"build-mangle": "esmangle rehype-raw.js > rehype-raw.min.js",
41-
"build": "npm run build-md && npm run build-bundle && npm run build-mangle",
42-
"lint": "xo",
43-
"test-api": "node test.js",
42+
"build": "npm run build-bundle && npm run build-mangle",
43+
"test-api": "node test",
4444
"test-coverage": "nyc --reporter lcov tape test.js",
45-
"test": "npm run build && npm run lint && npm run test-coverage"
45+
"test": "npm run format && npm run build && npm run test-coverage"
4646
},
4747
"nyc": {
4848
"check-coverage": true,
4949
"lines": 100,
5050
"functions": 100,
5151
"branches": 100
5252
},
53+
"prettier": {
54+
"tabWidth": 2,
55+
"useTabs": false,
56+
"singleQuote": true,
57+
"bracketSpacing": false,
58+
"semi": false,
59+
"trailingComma": "none"
60+
},
5361
"xo": {
54-
"space": true,
62+
"prettier": true,
5563
"esnext": false,
5664
"ignores": [
5765
"rehype-raw.js"

‎test.js

+31-28
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,40 @@
1-
'use strict';
1+
'use strict'
22

3-
var test = require('tape');
4-
var unified = require('unified');
5-
var parse = require('remark-parse');
6-
var remark2rehype = require('remark-rehype');
7-
var stringify = require('rehype-stringify');
8-
var raw = require('.');
3+
var test = require('tape')
4+
var unified = require('unified')
5+
var parse = require('remark-parse')
6+
var remark2rehype = require('remark-rehype')
7+
var stringify = require('rehype-stringify')
8+
var raw = require('.')
99

10-
test('integration', function (t) {
10+
test('integration', function(t) {
1111
unified()
1212
.use(parse)
1313
.use(remark2rehype, {allowDangerousHTML: true})
1414
.use(raw)
1515
.use(stringify)
16-
.process([
17-
'<div class="note">',
18-
'',
19-
'A mix of *markdown* and <em>HTML</em>.',
20-
'',
21-
'</div>'
22-
].join('\n'), function (err, file) {
23-
t.ifErr(err, 'should not fail');
16+
.process(
17+
[
18+
'<div class="note">',
19+
'',
20+
'A mix of *markdown* and <em>HTML</em>.',
21+
'',
22+
'</div>'
23+
].join('\n'),
24+
function(err, file) {
25+
t.ifErr(err, 'should not fail')
2426

25-
t.equal(
26-
String(file),
27-
[
28-
'<div class="note">',
29-
'<p>A mix of <em>markdown</em> and <em>HTML</em>.</p>',
30-
'</div>'
31-
].join('\n'),
32-
'should equal the fixture'
33-
);
34-
});
27+
t.equal(
28+
String(file),
29+
[
30+
'<div class="note">',
31+
'<p>A mix of <em>markdown</em> and <em>HTML</em>.</p>',
32+
'</div>'
33+
].join('\n'),
34+
'should equal the fixture'
35+
)
36+
}
37+
)
3538

36-
t.end();
37-
});
39+
t.end()
40+
})

0 commit comments

Comments
 (0)
Please sign in to comment.