Skip to content

Commit

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

var visit = require('unist-util-visit')
var position = require('unist-util-position')
var toString = require('nlcst-to-string')

module.exports = mentions
import visit from 'unist-util-visit'
import position from 'unist-util-position'
import toString from 'nlcst-to-string'

var genitive = /[']s?$/i

var gh =
/^@(?:[a-z\d]{1,2}|[a-z\d][a-z\d-]{1,37}[a-z\d])(\/(?:[a-z\d]{1,2}|[a-z\d][a-z\d-]{1,37}[a-z\d]))?$/i
var tw = /^@\w{1,15}$/i

function mentions(options) {
export default function retextSyntaxMentions(options) {
var style = (options || {}).style || 'github'

if (typeof style === 'string') {
Expand Down
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
"contributors": [
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"sideEffects": false,
"type": "module",
"main": "index.js",
"files": [
"index.js"
],
Expand All @@ -43,7 +46,7 @@
"tape": "^5.0.0",
"unist-builder": "^2.0.0",
"unist-util-remove-position": "^3.0.0",
"xo": "^0.37.0"
"xo": "^0.39.0"
},
"scripts": {
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
Expand All @@ -61,7 +64,10 @@
},
"xo": {
"prettier": true,
"esnext": false
"rules": {
"no-var": "off",
"prefer-arrow-callback": "off"
}
},
"remarkConfig": {
"plugins": [
Expand Down
12 changes: 5 additions & 7 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
'use strict'

var test = require('tape')
var retext = require('retext')
var u = require('unist-builder')
var clean = require('unist-util-remove-position')
var mentions = require('.')
import test from 'tape'
import retext from 'retext'
import u from 'unist-builder'
import clean from 'unist-util-remove-position'
import mentions from './index.js'

var position = retext().use(mentions)
var noPosition = retext().use(mentions).use(strip)
Expand Down

0 comments on commit c2f0f92

Please sign in to comment.