-
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add isNewDiscussion
and add it to hasRichTextEditor
#177
Add isNewDiscussion
and add it to hasRichTextEditor
#177
Conversation
0ba4476
to
a31e4a8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! 💚
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually this is not right. The “new discussion” page is not a “discussion”, there’s no discussion there.
#175 mentions hasRichTextEditor
. I think this should be moved to isNewDiscussion
and then isNewDiscussion
should be added to hasRichTextEditor
f3405fc
to
5868486
Compare
isDiscussion()
isNewDiscussion
and add it to hasRichTextEditor
index.ts
Outdated
@@ -213,6 +214,13 @@ addTests('isDiscussion', [ | |||
'https://github.com/orgs/community/discussions/11202', | |||
]); | |||
|
|||
export const isNewDiscussion = (url: URL | HTMLAnchorElement | Location = location): boolean => (getRepo(url)?.path === 'discussions/new' || getOrg(url)?.path === 'discussions/new') | |||
&& new URLSearchParams(url.search).get('category') !== null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? If you remove the category, it's redirected to https://github.com/withastro/roadmap/discussions/new/choose
Also sindresorhus/meta#7. I'm not sure why this lint rule isn't complaining https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-null.md
&& new URLSearchParams(url.search).get('category') !== null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you remove the category, it's redirected to withastro/roadmap/discussions/new/choose
Yes, But is withastro/roadmap/discussions/new/choose a new discussions? Because I'm referring to isNewIssue()
, which does not match issue/new/choose
, see Test CI for more details.
Also sindresorhus/meta#7. I'm not sure why this lint rule isn't complaining sindresorhus/eslint-plugin-unicorn@
main
/docs/rules/no-null.md
The no-null
has an option: checkStrictEquality, which is set to false by default. It must be manually enabled:
"xo": {
"overrides": [
"rules": {
...
+ "unicorn/no-null" : ["error", { "checkStrictEquality": false }],
}
]
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is withastro/roadmap/discussions/new/choose a new discussions
It's not and it's not matched by getRepo(url)?.path === 'discussions/new' || getOrg(url)?.path === 'discussions/new'
already. Redirects are not taken into considerations because github-url-detection
is meant to be used on real/final URLs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏽 I have already removed the category check.
49df56f
to
1114e0a
Compare
Thank you! |
The new discussion page will exist in the repo and org, e.g.:
And must excluded new discussion choose page, e.g.:
Solved: #175