Skip to content

Commit add541f

Browse files
committed
Refactor code-style
1 parent 70bd919 commit add541f

File tree

5 files changed

+36
-38
lines changed

5 files changed

+36
-38
lines changed

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
coverage/

index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
'use strict';
1+
'use strict'
22

3-
var is = require('unist-util-is');
3+
var is = require('unist-util-is')
44

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

77
var phrasing = [
88
'inlineCode',
@@ -17,9 +17,9 @@ var phrasing = [
1717
'imageReference',
1818
'footnoteReference',
1919
'text'
20-
];
20+
]
2121

2222
/* Check if a node is a phrasing element */
2323
function isPhrasing(node) {
24-
return is(phrasing, node);
24+
return is(phrasing, node)
2525
}

package.json

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,30 +23,35 @@
2323
"unist-util-is": "^2.1.1"
2424
},
2525
"devDependencies": {
26+
"nyc": "^13.0.0",
27+
"prettier": "^1.14.3",
2628
"remark-cli": "^6.0.0",
2729
"remark-preset-wooorm": "^4.0.0",
28-
"nyc": "^13.0.0",
2930
"tape": "^4.4.0",
3031
"xo": "^0.23.0"
3132
},
3233
"scripts": {
33-
"build-md": "remark . --quiet --frail --output",
34-
"build": "npm run build-md",
35-
"lint": "xo",
36-
"test-api": "node test.js",
34+
"format": "remark . -qfo && prettier --write '**/*.js' && xo --fix",
35+
"test-api": "node test",
3736
"test-coverage": "nyc --reporter lcov tape test.js",
38-
"pretest": "npm run lint",
39-
"test": "node test",
40-
"posttest": "npm run test-coverage"
37+
"test": "npm run format && npm run test-coverage"
4138
},
4239
"nyc": {
4340
"check-coverage": true,
4441
"lines": 100,
4542
"functions": 100,
4643
"branches": 100
4744
},
45+
"prettier": {
46+
"tabWidth": 2,
47+
"useTabs": false,
48+
"singleQuote": true,
49+
"bracketSpacing": false,
50+
"semi": false,
51+
"trailingComma": "none"
52+
},
4853
"xo": {
49-
"space": true,
54+
"prettier": true,
5055
"esnext": false,
5156
"rules": {
5257
"no-multi-assign": "off"

readme.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ npm install mdast-util-phrasing
1313
## Usage
1414

1515
```javascript
16-
var phrasing = require('mdast-util-phrasing');
16+
var phrasing = require('mdast-util-phrasing')
1717

1818
phrasing({
1919
type: 'paragraph',
2020
children: [{type: 'text', value: 'Alpha'}]
21-
}); //=> false
21+
}) // => false
2222

2323
phrasing({
2424
type: 'strong',
2525
children: [{type: 'text', value: 'Delta'}]
26-
}); //=> true
26+
}) // => true
2727
```
2828

2929
## API

test.js

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,42 @@
1-
'use strict';
1+
'use strict'
22

3-
var test = require('tape');
4-
var phrasing = require('.');
3+
var test = require('tape')
4+
var phrasing = require('.')
55

6-
test('phrasing', function (t) {
7-
t.equal(
8-
phrasing(),
9-
false,
10-
'should return `false` without node'
11-
);
6+
test('phrasing', function(t) {
7+
t.equal(phrasing(), false, 'should return `false` without node')
128

13-
t.equal(
14-
phrasing(null),
15-
false,
16-
'should return `false` with `null`'
17-
);
9+
t.equal(phrasing(null), false, 'should return `false` with `null`')
1810

1911
t.equal(
2012
phrasing({type: 'foo'}),
2113
false,
2214
'should return `false` when without known `node`'
23-
);
15+
)
2416

2517
t.equal(
2618
phrasing({type: 'link'}),
2719
true,
2820
'should return `true` when with a phrasing `node`'
29-
);
21+
)
3022

3123
t.equal(
3224
phrasing({type: 'strong'}),
3325
true,
3426
'should return `true` when with another phrasing `node`'
35-
);
27+
)
3628

3729
t.equal(
3830
phrasing({type: 'paragraph'}),
3931
false,
4032
'should return `false` when with a block `node`'
41-
);
33+
)
4234

4335
t.equal(
4436
phrasing({type: 'list'}),
4537
false,
4638
'should return `false` when with another block `node`'
47-
);
39+
)
4840

49-
t.end();
50-
});
41+
t.end()
42+
})

0 commit comments

Comments
 (0)