Skip to content

Commit

Permalink
Update dev-dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Apr 23, 2024
1 parent 4920393 commit daf03a0
Show file tree
Hide file tree
Showing 14 changed files with 51 additions and 58 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ jobs:
name: '${{matrix.node}} on ${{matrix.os}}'
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{matrix.node}}
- run: npm install
- run: npm test
- uses: codecov/codecov-action@v3
- uses: codecov/codecov-action@v4
strategy:
matrix:
os:
Expand Down
8 changes: 4 additions & 4 deletions lib/file-set-pipeline/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {reporter} from 'vfile-reporter'
*/
export async function log(context, settings) {
/** @type {VFileReporter} */
let func = reporter
let value = reporter

if (typeof settings.reporter === 'string') {
try {
Expand All @@ -41,17 +41,17 @@ export async function log(context, settings) {
})
)

func = result
value = result
} catch (error) {
throw new Error('Cannot find reporter `' + settings.reporter + '`', {
cause: error
})
}
} else if (settings.reporter) {
func = settings.reporter
value = settings.reporter
}

let diagnostics = await func(
let diagnostics = await value(
context.files.filter(function (file) {
return file.data.unifiedEngineGiven && !file.data.unifiedEngineIgnored
}),
Expand Down
4 changes: 2 additions & 2 deletions lib/file-set.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ export class FileSet extends EventEmitter {
let duplicate = false

if (completer && completer.pluginId) {
duplicate = this.plugins.some(function (fn) {
return fn.pluginId === completer.pluginId
duplicate = this.plugins.some(function (value) {
return value.pluginId === completer.pluginId
})
}

Expand Down
10 changes: 5 additions & 5 deletions lib/find-up.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,20 +287,20 @@ export class FindUp {
}

/**
* @param {Callback<Value>} cb
* @param {Callback<Value>} value
* Callback.
* @param {Array<Callback<Value>> | Error | Value | undefined} result
* Result.
* @returns {undefined}
* Nothing.
*/
function apply(cb, result) {
function apply(value, result) {
if (Array.isArray(result)) {
result.push(cb)
result.push(value)
} else if (result instanceof Error) {
cb(result)
value(result)
} else {
cb(undefined, result)
value(undefined, result)
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions lib/finder.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ function search(input, options, next) {
* Nothing.
*/
function each(file) {
const ext = typeof file === 'string' ? path.extname(file) : file.extname
const extname = typeof file === 'string' ? path.extname(file) : file.extname

// Normalise globs.
if (typeof file === 'string') {
Expand All @@ -282,13 +282,13 @@ function search(input, options, next) {
*/
function (error, result) {
const ignored = result && result.ignored
const dir = result && result.stats && result.stats.isDirectory()
const folder = result && result.stats && result.stats.isDirectory()

if (ignored && (options.nested || options.silentlyIgnore)) {
return one(undefined, [])
}

if (!ignored && dir) {
if (!ignored && folder) {
fs.readdir(
path.resolve(options.cwd, filePath(file)),
function (error, basenames) {
Expand Down Expand Up @@ -319,10 +319,10 @@ function search(input, options, next) {
}

if (
!dir &&
!folder &&
options.nested &&
options.extensions.length > 0 &&
(!ext || !options.extensions.includes(ext))
(!extname || !options.extensions.includes(extname))
) {
return one(undefined, [])
}
Expand Down
4 changes: 2 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ export function engine(options, callback) {
const result = isUrl(d) ? fileURLToPath(d) : d
return result
})
settings.extensions = (options.extensions || []).map(function (ext) {
return ext.charAt(0) === '.' ? ext : '.' + ext
settings.extensions = (options.extensions || []).map(function (value) {
return value.charAt(0) === '.' ? value : '.' + value
})

settings.filePath = options.filePath
Expand Down
21 changes: 6 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,20 @@
},
"devDependencies": {
"@types/parse-json": "^4.0.0",
"@types/ungap__structured-clone": "^0.3.0",
"c8": "^8.0.0",
"@types/ungap__structured-clone": "^1.0.0",
"c8": "^9.0.0",
"prettier": "^3.0.0",
"remark": "^15.0.0",
"remark-cli": "^12.0.0",
"remark-gfm": "^4.0.0",
"remark-preset-wooorm": "^9.0.0",
"remark-preset-wooorm": "^10.0.0",
"remark-toc": "^9.0.0",
"strip-ansi": "^7.0.0",
"type-coverage": "^2.0.0",
"typescript": "^5.0.0",
"unified": "^11.0.0",
"vfile-reporter-json": "^4.0.0",
"vfile-reporter-pretty": "^7.0.0",
"xo": "^0.56.0"
"xo": "^0.58.0"
},
"scripts": {
"build": "tsc --build --clean && tsc --build && type-coverage",
Expand All @@ -87,16 +86,7 @@
},
"remarkConfig": {
"plugins": [
"remark-preset-wooorm",
[
"remark-preset-wooorm/node_modules/remark-gfm/index.js",
false
],
"remark-gfm",
[
"remark-lint-list-item-indent",
"space"
]
"remark-preset-wooorm"
]
},
"xo": {
Expand All @@ -112,6 +102,7 @@
"prettier": true,
"rules": {
"complexity": "off",
"logical-assignment-operators": "off",
"no-await-in-loop": "off",
"no-unused-expressions": "off",
"unicorn/no-this-assignment": "off",
Expand Down
4 changes: 2 additions & 2 deletions test/completers.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,12 @@ test('completers', async function (t) {
})

const url = new URL('nested/foo.txt', cwd)
const doc = String(await fs.readFile(url))
const document = String(await fs.readFile(url))

await fs.unlink(url)

assert.equal(code, 0)
assert.equal(doc, '')
assert.equal(document, '')
assert.equal(stderr(), 'foo.txt > nested' + sep + 'foo.txt: written\n')
})
})
4 changes: 2 additions & 2 deletions test/inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ test('inspect', async function (t) {
streamError: stderr.stream
})

const doc = String(await fs.readFile(url))
const document = String(await fs.readFile(url))
await fs.unlink(url)

assert.equal(code, 0)
assert.equal(stderr(), 'one.txt > formatted.txt: written\n')
assert.equal(doc, 'text ""\n')
assert.equal(document, 'text ""\n')
})

await t.test('should support `inspect` for stdin', async function () {
Expand Down
12 changes: 6 additions & 6 deletions test/output.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,12 @@ test('output', async function (t) {
})

const url = new URL('one.txt', cwd)
const doc = String(await fs.readFile(url))
const document = String(await fs.readFile(url))
await fs.truncate(url)

assert.equal(code, 0)
assert.equal(stderr(), 'one.txt: written\n')
assert.equal(doc, 'two')
assert.equal(document, 'two')
})

await t.test('should write to a path', async function () {
Expand Down Expand Up @@ -261,13 +261,13 @@ test('output', async function (t) {
streamError: stderr.stream
})

const doc = String(await fs.readFile(new URL('one.txt', cwd)))
const document = String(await fs.readFile(new URL('one.txt', cwd)))

await fs.truncate(new URL('one.txt', cwd))

assert.equal(code, 0)
assert.equal(stderr(), 'one.txt: written\n')
assert.equal(doc, 'two')
assert.equal(document, 'two')
})

await t.test('should not write without file-path', async function () {
Expand All @@ -291,7 +291,7 @@ test('output', async function (t) {
streamError: stderr.stream
})

const doc = String(await fs.readFile(new URL('one.txt', cwd)))
const document = String(await fs.readFile(new URL('one.txt', cwd)))

assert.equal(code, 1)
assert.equal(
Expand All @@ -303,7 +303,7 @@ test('output', async function (t) {
' Error: Cannot write file without an output path'
].join('\n')
)
assert.equal(doc, '')
assert.equal(document, '')
})

await t.test('should fail when writing files to one path', async function () {
Expand Down
12 changes: 6 additions & 6 deletions test/tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ test('tree', async function (t) {
tree: true
})

const doc = String(await fs.readFile(new URL('doc.json', cwd)))
const document = String(await fs.readFile(new URL('doc.json', cwd)))

await fs.unlink(new URL('doc.json', cwd))

assert.equal(code, 0)
assert.equal(stderr(), 'doc > doc.json: written\n')
assert.equal(doc, '{\n "type": "text",\n "value": "two"\n}\n')
assert.equal(document, '{\n "type": "text",\n "value": "two"\n}\n')
}
)

Expand All @@ -88,13 +88,13 @@ test('tree', async function (t) {
treeIn: true
})

const doc = String(await fs.readFile(new URL('doc.foo', cwd)))
const document = String(await fs.readFile(new URL('doc.foo', cwd)))

await fs.unlink(new URL('doc.foo', cwd))

assert.equal(code, 0)
assert.equal(stderr(), 'doc > doc.foo: written\n')
assert.equal(doc, 'two')
assert.equal(document, 'two')
})

await t.test('should write JSON when `treeOut` is given', async function () {
Expand All @@ -118,13 +118,13 @@ test('tree', async function (t) {
treeOut: true
})

const doc = String(await fs.readFile(new URL('one.json', cwd)))
const document = String(await fs.readFile(new URL('one.json', cwd)))

await fs.unlink(new URL('one.json', cwd))

assert.equal(code, 0)
assert.equal(stderr(), 'one.txt > one.json: written\n')
assert.equal(doc, '{\n "type": "text",\n "value": "two"\n}\n')
assert.equal(document, '{\n "type": "text",\n "value": "two"\n}\n')
})

await t.test('should support `treeOut` for stdin', async function () {
Expand Down
6 changes: 3 additions & 3 deletions test/util/noop-processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ function parse() {
self.parser = parser

/**
* @param {string} doc
* @param {string} document
* @returns {Literal}
*/
function parser(doc) {
return {type: 'text', value: doc}
function parser(document) {
return {type: 'text', value: document}
}
}

Expand Down
6 changes: 3 additions & 3 deletions test/util/spy.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ export function spy() {
*/
// @ts-expect-error: TS can’t apply overloads I think?.
stream.write = function (chunk, encoding, callback) {
const cb = typeof encoding === 'function' ? encoding : callback
const value = typeof encoding === 'function' ? encoding : callback

if (typeof cb === 'function') {
setImmediate(cb, undefined)
if (typeof value === 'function') {
setImmediate(value, undefined)
}

output.push(chunk)
Expand Down
2 changes: 2 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
"exactOptionalPropertyTypes": true,
"lib": ["es2022"],
"module": "node16",
// To do: remove when `type-fest` is fixed (has too deep types currently).
"skipLibCheck": true,
"strict": true,
"target": "es2022"
},
Expand Down

0 comments on commit daf03a0

Please sign in to comment.