Skip to content

Commit 8c40f8d

Browse files
committed
Update xo
1 parent 650b75e commit 8c40f8d

File tree

3 files changed

+17
-19
lines changed

3 files changed

+17
-19
lines changed

index.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,13 @@
1111
* Repository to link against.
1212
*/
1313

14-
import fs from 'fs'
15-
import path from 'path'
14+
import fs from 'node:fs'
15+
import process from 'node:process'
16+
import path from 'node:path'
1617
import {visit} from 'unist-util-visit'
1718
import {toString} from 'mdast-util-to-string'
1819
import {findAndReplace} from 'mdast-util-find-and-replace'
1920

20-
// Hide process use from browserify and the like.
21-
const proc =
22-
typeof global === 'undefined'
23-
? /* c8 ignore next */
24-
{cwd: () => '/'}
25-
: global.process
26-
2721
// Previously, GitHub linked `@mention` and `@mentions` to their blog post about
2822
// mentions (<https://github.com/blog/821>).
2923
// Since June 2019, and possibly earlier, they stopped linking those references.
@@ -110,7 +104,7 @@ export default function remarkGithub(options = {}) {
110104
if (!repository) {
111105
try {
112106
pkg = JSON.parse(
113-
String(fs.readFileSync(path.join(proc.cwd(), 'package.json')))
107+
String(fs.readFileSync(path.join(process.cwd(), 'package.json')))
114108
)
115109
} catch {}
116110

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"type-coverage": "^2.0.0",
6161
"type-fest": "^2.0.0",
6262
"typescript": "^4.0.0",
63-
"xo": "^0.39.0"
63+
"xo": "^0.43.0"
6464
},
6565
"scripts": {
6666
"build": "rimraf \"test/**/*.d.ts\" \"*.d.ts\" && tsc && type-coverage",

test/index.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
* @typedef {import('../index.js').Options} Options
44
*/
55

6-
import fs from 'fs'
7-
import path from 'path'
6+
import assert from 'node:assert'
7+
import fs from 'node:fs'
8+
import path from 'node:path'
9+
import process from 'node:process'
810
import test from 'tape'
911
import {remark} from 'remark'
1012
import remarkGfm from 'remark-gfm'
@@ -51,22 +53,24 @@ test('Fixtures', (t) => {
5153
const input = read(join(filepath, 'input.md'), 'utf-8')
5254
const result = github(input, 'wooorm/remark')
5355

54-
test('should work on `' + fixture + '`', (t) => {
56+
t.doesNotThrow(() => {
5557
const results = result.split('\n')
5658
const outputs = output.split('\n')
5759
let index = -1
5860

59-
t.equal(results.length, outputs.length, 'should be same length')
61+
assert.strictEqual(
62+
results.length,
63+
outputs.length,
64+
'should be same length'
65+
)
6066

6167
while (++index < results.length) {
6268
const resultLine = results[index]
6369
if (resultLine !== '') {
64-
t.equal(resultLine, outputs[index], resultLine)
70+
assert.strictEqual(resultLine, outputs[index], resultLine)
6571
}
6672
}
67-
68-
t.end()
69-
})
73+
}, 'should work on `' + fixture + '`')
7074
}
7175

7276
t.end()

0 commit comments

Comments
 (0)