From fba7e3964fc5f6348f975b09c9a9d25773983d52 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 30 Jul 2021 17:57:15 +0200 Subject: [PATCH] Use ESM --- index.js | 10 +++------- package.json | 11 ++++++++--- test.js | 8 +++----- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/index.js b/index.js index 7501004..1470582 100644 --- a/index.js +++ b/index.js @@ -1,11 +1,7 @@ -'use strict' +import doctypes from 'doctype' +import h from 'hastscript' -var doctypes = require('doctype') -var h = require('hastscript') - -module.exports = document - -function document(options) { +export default function document(options) { var settings = options || {} var meta = cast(settings.meta) var link = cast(settings.link) diff --git a/package.json b/package.json index 2752d8e..731cfd0 100644 --- a/package.json +++ b/package.json @@ -25,11 +25,12 @@ "contributors": [ "Titus Wormer (https://wooorm.com)" ], + "sideEffects": false, + "type": "module", + "main": "index.js", "files": [ - "index.js", - "types/index.d.ts" + "index.js" ], - "types": "types/index.d.ts", "dependencies": { "@types/hast": "^2.0.0", "doctype": "^2.0.0", @@ -63,6 +64,10 @@ "xo": { "prettier": true, "esnext": false, + "rules": { + "no-var": "off", + "prefer-arrow-callback": "off" + }, "ignores": [ "**/*.ts" ] diff --git a/test.js b/test.js index 7f9c5dc..a8f32eb 100644 --- a/test.js +++ b/test.js @@ -1,8 +1,6 @@ -'use strict' - -var test = require('tape') -var rehype = require('rehype') -var document = require('.') +import test from 'tape' +import rehype from 'rehype' +import document from './index.js' test('document()', function (t) { t.equal(