Skip to content

Commit

Permalink
Update @types/mdast, utilities, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Sep 25, 2023
1 parent 0a780ee commit c81c6ab
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 59 deletions.
1 change: 1 addition & 0 deletions .remarkignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/test/fixtures/
1 change: 1 addition & 0 deletions lib/find/find-repo.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export async function findRepo(ctx) {
const {stdout} = await exec('git remote -v', {cwd: base})
const remote = stdout.match(/origin\t(.+?) \(fetch\)/)

// To do: don’t mutate.
ctx.options.repository = remote ? remote[1] : undefined

if (!ctx.options.repository) {
Expand Down
4 changes: 2 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @typedef {import('mdast').Root} Root
* @typedef {import('vfile').VFile} VFile
* @typedef {import('unified-engine').FileSet} FileSet
* @typedef {import('trough').Callback} Callback
* @typedef {import('unified').TransformCallback<Root>} Callback
*
* @typedef UrlConfig
* Hosted Git info
Expand All @@ -21,7 +21,7 @@
*
* @typedef Options
* Configuration.
* @property {string|false} [repository]
* @property {string | false | undefined} [repository]
* URL to hosted Git.
* If `repository` is nullish, the Git origin remote is detected.
* If the repository resolves to something npm understands as a Git host such
Expand Down
96 changes: 52 additions & 44 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
"description": "remark plugin to validate links to headings and files",
"license": "MIT",
"keywords": [
"unified",
"remark",
"remark-plugin",
"plugin",
"mdast",
"markdown",
"validate",
"file",
"heading",
"link",
"markdown",
"mdast",
"plugin",
"reference",
"file",
"heading"
"remark",
"remark-plugin",
"unified",
"validate"
],
"repository": "remarkjs/remark-validate-links",
"bugs": "https://github.com/remarkjs/remark-validate-links/issues",
Expand Down Expand Up @@ -46,66 +46,74 @@
"./lib/find/find-repo.js": "./lib/find/find-repo.browser.js"
},
"dependencies": {
"@types/mdast": "^3.0.0",
"@types/mdast": "^4.0.0",
"github-slugger": "^2.0.0",
"hosted-git-info": "^6.0.0",
"mdast-util-to-string": "^3.2.0",
"hosted-git-info": "^7.0.0",
"mdast-util-to-string": "^4.0.0",
"propose": "0.0.5",
"to-vfile": "^7.0.0",
"to-vfile": "^8.0.0",
"trough": "^2.0.0",
"unified": "^10.0.0",
"unified-engine": "^10.0.1",
"unist-util-visit": "^4.0.0",
"vfile": "^5.0.0"
"unified": "^11.0.0",
"unified-engine": "^11.0.0",
"unist-util-visit": "^5.0.0",
"vfile": "^6.0.0"
},
"devDependencies": {
"@types/hast": "^2.0.0",
"@types/hast": "^3.0.0",
"@types/hosted-git-info": "^3.0.0",
"@types/rimraf": "^3.0.1",
"@types/tape": "^4.0.0",
"c8": "^7.0.0",
"prettier": "^2.0.0",
"remark": "^14.0.0",
"@types/node": "^20.0.0",
"c8": "^8.0.0",
"prettier": "^3.0.0",
"remark": "^15.0.0",
"remark-cli": "^11.0.0",
"remark-preset-wooorm": "^9.0.0",
"rimraf": "^3.0.0",
"strip-ansi": "^7.0.0",
"tape": "^5.0.0",
"type-coverage": "^2.0.0",
"typescript": "^5.0.0",
"vfile-sort": "^3.0.0",
"xo": "^0.54.0"
"vfile-sort": "^4.0.0",
"xo": "^0.56.0"
},
"scripts": {
"build": "rimraf \"lib/**/*.d.ts\" \"test/**/*.d.ts\" \"*.d.ts\" && tsc && type-coverage",
"format": "remark . -qfo --ignore-pattern test/ && prettier . -w --loglevel warn && xo --fix",
"build": "tsc --build --clean && tsc --build && type-coverage",
"format": "remark . --frail --output --quiet && prettier . --log-level warn --write && xo --fix",
"prepack": "npm run build && npm run format",
"test": "npm run build && npm run format && npm run test-coverage",
"test-api": "node --conditions development test/index.js",
"test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov npm run test-api",
"test": "npm run build && npm run format && npm run test-coverage"
"test-coverage": "c8 --100 --reporter lcov npm run test-api"
},
"prettier": {
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"bracketSpacing": false,
"singleQuote": true,
"semi": false,
"trailingComma": "none"
},
"xo": {
"prettier": true,
"rules": {
"unicorn/prefer-logical-operator-over-ternary": "off"
}
"tabWidth": 2,
"trailingComma": "none",
"useTabs": false
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
"remark-preset-wooorm"
]
},
"typeCoverage": {
"atLeast": 100,
"detail": true,
"strict": true,
"ignoreCatch": true
"ignoreCatch": true,
"strict": true
},
"xo": {
"overrides": [
{
"files": [
"test/**/*.js"
],
"rules": {
"no-await-in-loop": "off"
}
}
],
"prettier": true,
"rules": {
"unicorn/prefer-logical-operator-over-ternary": "off"
}
}
}
14 changes: 11 additions & 3 deletions test/sort.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
import {sort} from 'vfile-sort'
/**
* @typedef {import('mdast').Root} Root
* @typedef {import('vfile').VFile} VFile
*/

import {compareMessage} from 'vfile-sort'

/** @type {import('unified').Plugin<void[]>} */
export default function unifiedSort() {
/**
* @param {Root} _
* @param {VFile} file
*/
return (_, file) => {
sort(file)
file.messages.sort(compareMessage)
}
}
19 changes: 9 additions & 10 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
{
"include": ["lib/**/*.js", "test/**/*.js", "*.js"],
"compilerOptions": {
"target": "ES2020",
"lib": ["ES2020"],
"module": "ES2020",
"moduleResolution": "node",
"allowJs": true,
"checkJs": true,
"customConditions": ["development"],
"declaration": true,
"emitDeclarationOnly": true,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true,
"strict": true
}
"exactOptionalPropertyTypes": true,
"lib": ["es2020"],
"module": "node16",
"strict": true,
"target": "es2020"
},
"exclude": ["coverage/", "node_modules/"],
"include": ["**/*.js"]
}

0 comments on commit c81c6ab

Please sign in to comment.