Skip to content

Commit 646929e

Browse files
committed
Update dev-dependencies
1 parent e1f3de0 commit 646929e

File tree

6 files changed

+51
-54
lines changed

6 files changed

+51
-54
lines changed

cli.js

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env node
2-
import fs from 'fs'
2+
import fs from 'node:fs'
3+
import process from 'node:process'
34
import notifier from 'update-notifier'
45
import supportsColor from 'supports-color'
56
import meow from 'meow'
@@ -23,7 +24,7 @@ const pack = JSON.parse(
2324
fs.readFileSync(new URL('./package.json', import.meta.url))
2425
)
2526

26-
var textExtensions = [
27+
const textExtensions = [
2728
'txt',
2829
'text',
2930
'md',
@@ -33,14 +34,14 @@ var textExtensions = [
3334
'mkdown',
3435
'ron'
3536
]
36-
var htmlExtensions = ['htm', 'html']
37-
var mdxExtensions = ['mdx']
37+
const htmlExtensions = ['htm', 'html']
38+
const mdxExtensions = ['mdx']
3839

3940
// Update messages.
4041
notifier({pkg: pack}).notify()
4142

4243
// Set-up meow.
43-
var cli = meow(
44+
const cli = meow(
4445
[
4546
'Usage: alex [<glob> ...] [options ...]',
4647
'',
@@ -81,14 +82,14 @@ var cli = meow(
8182
)
8283

8384
// Set-up.
84-
var extensions = cli.flags.html
85+
const extensions = cli.flags.html
8586
? htmlExtensions
8687
: cli.flags.mdx
8788
? mdxExtensions
8889
: textExtensions
89-
var defaultGlobs = ['{docs/**/,doc/**/,}*.{' + extensions.join(',') + '}']
90-
var silentlyIgnore
91-
var globs
90+
const defaultGlobs = ['{docs/**/,doc/**/,}*.{' + extensions.join(',') + '}']
91+
let silentlyIgnore
92+
let globs
9293

9394
if (cli.flags.stdin) {
9495
if (cli.input.length > 0) {
@@ -105,7 +106,7 @@ engine(
105106
{
106107
processor: unified(),
107108
files: globs,
108-
extensions: extensions,
109+
extensions,
109110
configTransform: transform,
110111
out: false,
111112
output: false,
@@ -118,7 +119,7 @@ engine(
118119
},
119120
quiet: cli.flags.quiet,
120121
ignoreName: '.alexignore',
121-
silentlyIgnore: silentlyIgnore,
122+
silentlyIgnore,
122123
frail: true,
123124
defaultConfig: transform()
124125
},
@@ -129,27 +130,23 @@ engine(
129130
)
130131

131132
function transform(options) {
132-
var settings = options || {}
133-
var plugins = [
133+
const settings = options || {}
134+
let plugins = [
134135
retextEnglish,
135136
[retextProfanities, {sureness: settings.profanitySureness}],
136137
[retextEquality, {noBinary: settings.noBinary}]
137138
]
138139

139140
if (cli.flags.html) {
140-
plugins = [rehypeParse, [rehypeRetext, unified().use({plugins: plugins})]]
141+
plugins = [rehypeParse, [rehypeRetext, unified().use({plugins})]]
141142
} else if (cli.flags.mdx) {
142-
plugins = [
143-
remarkParse,
144-
remarkMdx,
145-
[remarkRetext, unified().use({plugins: plugins})]
146-
]
143+
plugins = [remarkParse, remarkMdx, [remarkRetext, unified().use({plugins})]]
147144
} else if (!cli.flags.text) {
148145
plugins = [
149146
remarkParse,
150147
remarkGfm,
151148
[remarkFrontmatter, ['yaml', 'toml']],
152-
[remarkRetext, unified().use({plugins: plugins})]
149+
[remarkRetext, unified().use({plugins})]
153150
]
154151
}
155152

@@ -161,5 +158,5 @@ function transform(options) {
161158
plugins.push(unifiedDiff)
162159
}
163160

164-
return {plugins: plugins}
161+
return {plugins}
165162
}

filter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import remarkMessageControl from 'remark-message-control'
22

33
export function filter(options) {
44
/* c8 ignore next */
5-
var settings = options || {}
5+
const settings = options || {}
66

77
if (settings.allow && settings.deny) {
88
throw new Error(

index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ function makeText(config) {
2626

2727
// Alex’s core.
2828
function core(value, config, processor) {
29-
var allow
30-
var deny
29+
let allow
30+
let deny
3131

3232
if (Array.isArray(config)) {
3333
allow = config
@@ -36,8 +36,8 @@ function core(value, config, processor) {
3636
deny = config.deny
3737
}
3838

39-
var file = new VFile(value)
40-
var tree = processor.use(filter, {allow: allow, deny: deny}).parse(file)
39+
const file = new VFile(value)
40+
const tree = processor.use(filter, {allow, deny}).parse(file)
4141

4242
processor.runSync(tree, file)
4343

package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@
8787
"devDependencies": {
8888
"c8": "^7.10.0",
8989
"prettier": "^2.0.0",
90-
"remark-cli": "^9.0.0",
91-
"remark-preset-wooorm": "^8.0.0",
90+
"remark-cli": "^10.0.0",
91+
"remark-preset-wooorm": "^9.0.0",
9292
"tape": "^5.0.0",
93-
"vfile-reporter-json": "^2.0.0",
94-
"xo": "^0.38.0"
93+
"vfile-reporter-json": "^3.0.0",
94+
"xo": "^0.45.0"
9595
},
9696
"scripts": {
9797
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
@@ -114,7 +114,6 @@
114114
},
115115
"xo": {
116116
"prettier": true,
117-
"esnext": false,
118117
"rules": {
119118
"ava/no-import-test-files": "off",
120119
"unicorn/no-array-callback-reference": "off"

test/api.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import fs from 'fs'
1+
import fs from 'node:fs'
22
import test from 'tape'
33
import alex, {markdown, mdx, text, html} from '../index.js'
44

5-
var threeHtml = fs.readFileSync(
5+
const threeHtml = fs.readFileSync(
66
new URL('./fixtures/three.html', import.meta.url)
77
)
8-
var fourMdx = fs.readFileSync(new URL('./fixtures/four.mdx', import.meta.url))
8+
const fourMdx = fs.readFileSync(new URL('./fixtures/four.mdx', import.meta.url))
99

1010
// Tests. Note that these are small because alex is in fact
1111
// just a collection of well-tested modules.

test/cli.js

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import fs from 'fs'
2-
import path from 'path'
3-
import childProcess from 'child_process'
1+
import childProcess from 'node:child_process'
2+
import fs from 'node:fs'
3+
import path from 'node:path'
4+
import process from 'node:process'
45
import test from 'tape'
56

67
const pkg = JSON.parse(fs.readFileSync('package.json'))
@@ -37,7 +38,7 @@ test('alex-cli', function (t) {
3738
t.test('stdin', function (t) {
3839
t.plan(1)
3940

40-
var subprocess = childProcess.exec('./cli.js --stdin', onexec)
41+
const subprocess = childProcess.exec('./cli.js --stdin', onexec)
4142

4243
setTimeout(end, 10)
4344

@@ -65,7 +66,7 @@ test('alex-cli', function (t) {
6566
})
6667

6768
t.test('stdin and globs', function (t) {
68-
var fp = path.join('test', 'fixtures', 'one.md')
69+
const fp = path.join('test', 'fixtures', 'one.md')
6970

7071
t.plan(1)
7172

@@ -81,7 +82,7 @@ test('alex-cli', function (t) {
8182
})
8283

8384
t.test('markdown by default', function (t) {
84-
var fp = path.join('test', 'fixtures', 'one.md')
85+
const fp = path.join('test', 'fixtures', 'one.md')
8586

8687
t.plan(1)
8788

@@ -97,7 +98,7 @@ test('alex-cli', function (t) {
9798
})
9899

99100
t.test('optionally html', function (t) {
100-
var fp = path.join('test', 'fixtures', 'three.html')
101+
const fp = path.join('test', 'fixtures', 'three.html')
101102

102103
t.plan(1)
103104

@@ -113,7 +114,7 @@ test('alex-cli', function (t) {
113114
})
114115

115116
t.test('optionally text (on markdown)', function (t) {
116-
var fp = path.join('test', 'fixtures', 'one.md')
117+
const fp = path.join('test', 'fixtures', 'one.md')
117118

118119
t.plan(1)
119120

@@ -129,7 +130,7 @@ test('alex-cli', function (t) {
129130
})
130131

131132
t.test('optionally text (on html)', function (t) {
132-
var fp = path.join('test', 'fixtures', 'three.html')
133+
const fp = path.join('test', 'fixtures', 'three.html')
133134

134135
t.plan(1)
135136

@@ -145,7 +146,7 @@ test('alex-cli', function (t) {
145146
})
146147

147148
t.test('mdx', function (t) {
148-
var fp = path.join('test', 'fixtures')
149+
const fp = path.join('test', 'fixtures')
149150

150151
t.plan(1)
151152

@@ -161,7 +162,7 @@ test('alex-cli', function (t) {
161162
})
162163

163164
t.test('successful', function (t) {
164-
var fp = path.join('test', 'fixtures', 'ok.txt')
165+
const fp = path.join('test', 'fixtures', 'ok.txt')
165166

166167
t.plan(1)
167168

@@ -177,7 +178,7 @@ test('alex-cli', function (t) {
177178
})
178179

179180
t.test('quiet (ok)', function (t) {
180-
var fp = path.join('test', 'fixtures', 'ok.txt')
181+
const fp = path.join('test', 'fixtures', 'ok.txt')
181182

182183
t.plan(1)
183184

@@ -189,7 +190,7 @@ test('alex-cli', function (t) {
189190
})
190191

191192
t.test('quiet (on error)', function (t) {
192-
var fp = path.join('test', 'fixtures', 'one.md')
193+
const fp = path.join('test', 'fixtures', 'one.md')
193194

194195
t.plan(1)
195196

@@ -215,7 +216,7 @@ test('alex-cli', function (t) {
215216
})
216217

217218
t.test('binary (default: ok)', function (t) {
218-
var fp = path.join('test', 'fixtures', 'binary', 'two.md')
219+
const fp = path.join('test', 'fixtures', 'binary', 'two.md')
219220

220221
t.plan(1)
221222

@@ -231,7 +232,7 @@ test('alex-cli', function (t) {
231232
})
232233

233234
t.test('binary (with config file)', function (t) {
234-
var fp = path.join('test', 'fixtures', 'non-binary', 'two.md')
235+
const fp = path.join('test', 'fixtures', 'non-binary', 'two.md')
235236

236237
t.plan(1)
237238

@@ -258,7 +259,7 @@ test('alex-cli', function (t) {
258259
})
259260

260261
t.test('profanity (default)', function (t) {
261-
var fp = path.join('test', 'fixtures', 'profanity', 'two.md')
262+
const fp = path.join('test', 'fixtures', 'profanity', 'two.md')
262263

263264
t.plan(1)
264265

@@ -284,7 +285,7 @@ test('alex-cli', function (t) {
284285
})
285286

286287
t.test('profanity (with config file)', function (t) {
287-
var fp = path.join('test', 'fixtures', 'profanity-sureness', 'two.md')
288+
const fp = path.join('test', 'fixtures', 'profanity-sureness', 'two.md')
288289

289290
t.plan(1)
290291

@@ -300,7 +301,7 @@ test('alex-cli', function (t) {
300301
})
301302

302303
t.test('custom reporter', function (t) {
303-
var fp = path.join('test', 'fixtures', 'profanity-sureness', 'two.md')
304+
const fp = path.join('test', 'fixtures', 'profanity-sureness', 'two.md')
304305

305306
t.plan(1)
306307

@@ -325,7 +326,7 @@ test('alex-cli', function (t) {
325326
})
326327

327328
t.test("custom formatter that isn't installed", function (t) {
328-
var fp = path.join('test', 'fixtures', 'profanity-sureness', 'two.md')
329+
const fp = path.join('test', 'fixtures', 'profanity-sureness', 'two.md')
329330

330331
t.plan(1)
331332

@@ -341,7 +342,7 @@ test('alex-cli', function (t) {
341342
})
342343

343344
t.test('deny', function (t) {
344-
var fp = path.join('test', 'fixtures', 'deny', 'two.md')
345+
const fp = path.join('test', 'fixtures', 'deny', 'two.md')
345346

346347
t.plan(1)
347348

0 commit comments

Comments
 (0)