Skip to content

Commit

Permalink
Update @types/nlcst, unified, utilities, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Sep 11, 2023
1 parent 43f55f6 commit f4b611c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 33 deletions.
7 changes: 4 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default function retextSpell(options = {}) {
normalizeApostrophes,
personal
} = options
/** @type {Array<[Root, VFile, Config, (error?: Error|null|undefined) => void]>} */
/** @type {Array<[Root, VFile, Config, import('unified').TransformCallback<Root>]>} */
const queue = []
/** @type {Error|null|undefined} */
let loadError
Expand Down Expand Up @@ -128,7 +128,8 @@ export default function retextSpell(options = {}) {
all(...parameters)
}

queue[index][3](error)
// To do: `dictionary`s should not pass `null`.
queue[index][3](error || undefined)
}

queue.length = 0
Expand Down Expand Up @@ -175,7 +176,7 @@ function all(tree, file, config) {

if (
!parent ||
position === null ||
position === undefined ||
(ignoreLiteral && isLiteral(parent, position))
) {
return
Expand Down
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,35 +37,35 @@
"index.js"
],
"dependencies": {
"@types/nlcst": "^1.0.0",
"nlcst-is-literal": "^2.0.0",
"nlcst-to-string": "^3.0.0",
"@types/nlcst": "^2.0.0",
"nlcst-is-literal": "^3.0.0",
"nlcst-to-string": "^4.0.0",
"nspell": "^2.0.0",
"quotation": "^2.0.0",
"unified": "^10.0.0",
"unist-util-visit": "^4.0.0"
"unified": "^11.0.0",
"unist-util-visit": "^5.0.0"
},
"devDependencies": {
"@types/tape": "^5.0.0",
"@types/unist": "^2.0.0",
"@types/unist": "^3.0.0",
"c8": "^8.0.0",
"dictionary-en": "^3.0.0",
"dictionary-en-gb": "^2.0.0",
"prettier": "^3.0.0",
"remark-cli": "^11.0.0",
"remark-preset-wooorm": "^9.0.0",
"retext": "^8.0.0",
"retext-emoji": "^8.0.0",
"retext": "^9.0.0",
"retext-emoji": "^9.0.0",
"rimraf": "^3.0.0",
"tape": "^5.0.0",
"type-coverage": "^2.0.0",
"typescript": "^5.0.0",
"vfile": "^5.0.0",
"vfile": "^6.0.0",
"xo": "^0.56.0"
},
"scripts": {
"build": "rimraf \"*.d.ts\" && tsc && type-coverage",
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
"format": "remark . -qfo && prettier . -w --log-level warn && xo --fix",
"test-api": "node --conditions development test.js",
"test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node --conditions development test.js",
"test": "npm run build && npm run format && npm run test-coverage"
Expand Down
39 changes: 19 additions & 20 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,26 +54,25 @@ test('should warn for misspelt words', async (t) => {
const file = await retext().use(retextSpell, enGb).process('color')

t.deepEqual(
JSON.parse(JSON.stringify(file.messages)),
[
{
name: '1:1-1:6',
message: '`color` is misspelt; did you mean `colon`, `colour`, `Colo`?',
reason: '`color` is misspelt; did you mean `colon`, `colour`, `Colo`?',
line: 1,
column: 1,
source: 'retext-spell',
ruleId: 'color',
position: {
start: {line: 1, column: 1, offset: 0},
end: {line: 1, column: 6, offset: 5}
},
fatal: false,
actual: 'color',
expected: ['colon', 'colour', 'Colo'],
url: 'https://github.com/retextjs/retext-spell#readme'
}
],
JSON.parse(JSON.stringify({...file.messages[0], ancestors: []})),
{
ancestors: [],
column: 1,
fatal: false,
message: '`color` is misspelt; did you mean `colon`, `colour`, `Colo`?',
line: 1,
name: '1:1-1:6',
place: {
start: {line: 1, column: 1, offset: 0},
end: {line: 1, column: 6, offset: 5}
},
reason: '`color` is misspelt; did you mean `colon`, `colour`, `Colo`?',
ruleId: 'color',
source: 'retext-spell',
actual: 'color',
expected: ['colon', 'colour', 'Colo'],
url: 'https://github.com/retextjs/retext-spell#readme'
},
'should emit messages'
)

Expand Down

0 comments on commit f4b611c

Please sign in to comment.