Skip to content

Commit

Permalink
Use ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Aug 5, 2021
1 parent 1d5afb9 commit 0b9dc42
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 22 deletions.
12 changes: 4 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
'use strict'

var syntax = require('micromark-extension-directive')
var fromMarkdown = require('mdast-util-directive/from-markdown')
var toMarkdown = require('mdast-util-directive/to-markdown')
import syntax from 'micromark-extension-directive'
import fromMarkdown from 'mdast-util-directive/from-markdown.js'
import toMarkdown from 'mdast-util-directive/to-markdown.js'

var warningIssued

module.exports = directive

function directive() {
export default function remarkDirective() {
var data = this.data()

// Old remark.
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@
"contributors": [
"Titus Wormer <[email protected]> (https://wooorm.com)"
],
"types": "types/index.d.ts",
"sideEffects": false,
"type": "module",
"main": "index.js",
"files": [
"types/index.d.ts",
"index.js"
],
"dependencies": {
Expand Down Expand Up @@ -66,6 +67,8 @@
"prettier": true,
"esnext": false,
"rules": {
"no-var": "off",
"prefer-arrow-callback": "off",
"unicorn/no-array-callback-reference": "off",
"unicorn/prefer-optional-catch-binding": "off"
},
Expand Down
22 changes: 10 additions & 12 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
'use strict'

var fs = require('fs')
var path = require('path')
var test = require('tape')
var vfile = require('to-vfile')
var unified = require('unified')
var remark = require('remark')
var not = require('not')
var hidden = require('is-hidden')
var directive = require('..')
import fs from 'fs'
import path from 'path'
import test from 'tape'
import vfile from 'to-vfile'
import unified from 'unified'
import remark from 'remark'
import not from 'not'
import hidden from 'is-hidden'
import directive from '../index.js'

test('directive()', function (t) {
t.doesNotThrow(function () {
Expand All @@ -23,7 +21,7 @@ test('directive()', function (t) {
})

test('fixtures', function (t) {
var base = path.join(__dirname, 'fixtures')
var base = path.join('test', 'fixtures')
var entries = fs.readdirSync(base).filter(not(hidden))

t.plan(entries.length)
Expand Down

0 comments on commit 0b9dc42

Please sign in to comment.