remarkjs / remark-github

remark plugin to link references to commits, issues, pull-requests, and users, like on GitHub

Home Page:https://remark.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing or invalid `repository` field in `options`

swyxio opened this issue · comments

Initial checklist

Affected packages and versions

latest

Link to runnable example

https://codesandbox.io/s/cool-swirles-vbp4nr?file=/src/index.js

Steps to reproduce

as above in codesandbox

Expected behavior

either the repository field is optional, in which case it should not error, or the docs and code samples should show that it is required

Actual behavior

image

Runtime

No response

Package manager

No response

OS

No response

Build and bundle tools

No response

commented

It seems you waited this repository expression for example #2
Did you add options like this?

.use(remarkGithub, [
  {
    repository: "your-id/your-repo",
  }
])
commented

either the repository field is optional, in which case it should not error, or the docs and code samples should show that it is required

It is optional in some environments (Node.js). (In the future Deno or whatever else has alternatives to node:fs). It can’t be optional in browsers.

I’m not sure how to handle this other than: type-wise and in the typical-case it is optional. In some cases that doesn‘t work and you get a runtime error ASAP when that’s the case.

What do you suggest to these docs? https://github.com/remarkjs/remark-github#optionsrepository

commented

Closing as options.repository is in several cases optional. Open to hearing on what language you think would make it more clear in which cases it isn’t

Hi! This was closed. Team: If this was fixed, please add phase/solved. Otherwise, please add one of the no/* labels.