Skip to content

Commit b70d6ae

Browse files
committed
Use ESM
1 parent 7ae25a8 commit b70d6ae

File tree

6 files changed

+24
-29
lines changed

6 files changed

+24
-29
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
.DS_Store
22
*.log
3-
.nyc_output/
43
coverage/
54
node_modules/
65
yarn.lock

.prettierignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
coverage/
2-
*.json
32
*.md

index.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
'use strict'
1+
import {remove} from 'unist-util-remove'
22

3-
var remove = require('unist-util-remove')
4-
5-
module.exports = squeeze
6-
7-
function squeeze(tree) {
3+
export function squeezeParagraphs(tree) {
84
return remove(tree, {cascade: false}, isEmptyParagraph)
95
}
106

package.json

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,33 +30,30 @@
3030
"Eugene Sharygin <eush77@gmail.com>",
3131
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
3232
],
33+
"sideEffects": false,
34+
"type": "module",
35+
"main": "index.js",
3336
"files": [
3437
"index.js"
3538
],
3639
"dependencies": {
37-
"unist-util-remove": "^2.0.0"
40+
"unist-util-remove": "^3.0.0"
3841
},
3942
"devDependencies": {
40-
"nyc": "^15.0.0",
43+
"c8": "^7.0.0",
4144
"prettier": "^2.0.0",
4245
"remark-cli": "^9.0.0",
4346
"remark-preset-wooorm": "^8.0.0",
4447
"tape": "^5.0.0",
45-
"unist-builder": "^2.0.0",
46-
"xo": "^0.38.0"
48+
"unist-builder": "^3.0.0",
49+
"xo": "^0.39.0"
4750
},
4851
"scripts": {
4952
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
50-
"test-api": "node test",
51-
"test-coverage": "nyc --reporter lcov tape test.js",
53+
"test-api": "node test.js",
54+
"test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node test.js",
5255
"test": "npm run format && npm run test-coverage"
5356
},
54-
"nyc": {
55-
"check-coverage": true,
56-
"lines": 100,
57-
"functions": 100,
58-
"branches": 100
59-
},
6057
"prettier": {
6158
"tabWidth": 2,
6259
"useTabs": false,
@@ -67,9 +64,9 @@
6764
},
6865
"xo": {
6966
"prettier": true,
70-
"esnext": false,
7167
"rules": {
72-
"unicorn/no-fn-reference-in-iterator": "off"
68+
"no-var": "off",
69+
"prefer-arrow-callback": "off"
7370
}
7471
},
7572
"remarkConfig": {

readme.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ characters.
1515

1616
## Install
1717

18+
This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c):
19+
Node 12+ is needed to use it and it must be `import`ed instead of `require`d.
20+
1821
[npm][]:
1922

2023
```sh
@@ -24,8 +27,8 @@ npm install mdast-squeeze-paragraphs
2427
## Use
2528

2629
```js
27-
var u = require('unist-builder')
28-
var squeezeParagraphs = require('mdast-squeeze-paragraphs')
30+
import {u} from 'unist-builder'
31+
import {squeezeParagraphs} from 'mdast-squeeze-paragraphs'
2932

3033
var tree = u('root', [
3134
u('paragraph', []),
@@ -49,6 +52,9 @@ Yields:
4952

5053
## API
5154

55+
This package exports the following identifiers: `squeezeParagraphs`.
56+
There is no default export.
57+
5258
### `squeezeParagraphs(tree)`
5359

5460
Modifies [tree][] in-place.

test.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
'use strict'
2-
3-
var test = require('tape')
4-
var u = require('unist-builder')
5-
var squeezeParagraphs = require('.')
1+
import test from 'tape'
2+
import {u} from 'unist-builder'
3+
import {squeezeParagraphs} from './index.js'
64

75
test(function (t) {
86
t.deepEqual(

0 commit comments

Comments
 (0)