remark-github icon indicating copy to clipboard operation
remark-github copied to clipboard

Missing or invalid `repository` field in `options`

Open swyxio opened this issue 2 years ago • 2 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

swyxio avatar Aug 07 '22 23:08 swyxio

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

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

nabi-chan avatar Aug 08 '22 16:08 nabi-chan

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

wooorm avatar Aug 08 '22 19:08 wooorm

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

wooorm avatar Aug 23 '22 19:08 wooorm

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

github-actions[bot] avatar Aug 23 '22 19:08 github-actions[bot]