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 10, 2023
1 parent 20f9ab0 commit 44790e3
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 62 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default function retextQuotes(options = {}) {
const actual = toString(node)
const style = check(actual, straight, smart)

if (!style || !parent || index === null) {
if (!style || !parent || index === undefined) {
return
}

Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,21 @@
"index.js"
],
"dependencies": {
"@types/nlcst": "^1.0.0",
"@types/unist": "^2.0.6",
"nlcst-to-string": "^3.0.0",
"unified": "^10.0.0",
"unist-util-is": "^5.0.0",
"unist-util-visit": "^4.0.0"
"@types/nlcst": "^2.0.0",
"@types/unist": "^3.0.0",
"nlcst-to-string": "^4.0.0",
"unified": "^11.0.0",
"unist-util-is": "^6.0.0",
"unist-util-visit": "^5.0.0"
},
"devDependencies": {
"@types/tape": "^5.0.0",
"c8": "^8.0.0",
"prettier": "^3.0.0",
"remark-cli": "^11.0.0",
"remark-preset-wooorm": "^9.0.0",
"retext": "^8.0.0",
"retext-syntax-urls": "^3.0.0",
"retext": "^9.0.0",
"retext-syntax-urls": "^4.0.0",
"rimraf": "^3.0.0",
"tape": "^5.0.0",
"type-coverage": "^2.0.0",
Expand Down
71 changes: 18 additions & 53 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,60 +36,25 @@ test('retext-quotes', (t) => {
.process('Isn\'t it "funny"?')
.then((file) => {
t.deepEqual(
JSON.parse(JSON.stringify(file.messages)),
[
{
name: '1:4-1:5',
message: "Expected a smart apostrophe: `’`, not `'`",
reason: "Expected a smart apostrophe: `’`, not `'`",
line: 1,
column: 4,
source: 'retext-quotes',
ruleId: 'apostrophe',
position: {
start: {line: 1, column: 4, offset: 3},
end: {line: 1, column: 5, offset: 4}
},
fatal: false,
actual: "'",
expected: ['’'],
url: 'https://github.com/retextjs/retext-quotes#readme'
},
{
name: '1:10-1:11',
message: 'Expected a smart quote: `“`, not `"`',
reason: 'Expected a smart quote: `“`, not `"`',
line: 1,
column: 10,
source: 'retext-quotes',
ruleId: 'quote',
position: {
start: {line: 1, column: 10, offset: 9},
end: {line: 1, column: 11, offset: 10}
},
fatal: false,
actual: '"',
expected: ['“'],
url: 'https://github.com/retextjs/retext-quotes#readme'
JSON.parse(JSON.stringify({...file.messages[0], ancestors: []})),
{
ancestors: [],
column: 4,
fatal: false,
message: "Expected a smart apostrophe: `’`, not `'`",
line: 1,
name: '1:4-1:5',
place: {
start: {line: 1, column: 4, offset: 3},
end: {line: 1, column: 5, offset: 4}
},
{
name: '1:16-1:17',
message: 'Expected a smart quote: `”`, not `"`',
reason: 'Expected a smart quote: `”`, not `"`',
line: 1,
column: 16,
source: 'retext-quotes',
ruleId: 'quote',
position: {
start: {line: 1, column: 16, offset: 15},
end: {line: 1, column: 17, offset: 16}
},
fatal: false,
actual: '"',
expected: ['”'],
url: 'https://github.com/retextjs/retext-quotes#readme'
}
],
reason: "Expected a smart apostrophe: `’`, not `'`",
ruleId: 'apostrophe',
source: 'retext-quotes',
actual: "'",
expected: ['’'],
url: 'https://github.com/retextjs/retext-quotes#readme'
},
'should emit messages'
)
}, t.ifErr)
Expand Down

0 comments on commit 44790e3

Please sign in to comment.