Skip to content
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

All: Seperate allPossibleCategories to @joplin/lib #6754

Merged
merged 8 commits into from
Sep 9, 2022

Conversation

Retr0ve
Copy link
Contributor

@Retr0ve Retr0ve commented Aug 16, 2022

To better maintain the plugin categories, I separate allPossibleCategories variable from webpack script to a json file under @joplin/lib.

@laurent22
Copy link
Owner

Ok I think it's good now. If you could fix the conflict we can merge.

@Retr0ve
Copy link
Contributor Author

Retr0ve commented Aug 31, 2022

I‘ve fixed the conflict now.

Copy link
Collaborator

@personalizedrefrigerator personalizedrefrigerator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the below comment, this looks good to me!

@@ -73,7 +73,7 @@ function validateCategories(categories) {
if (!categories) return null;
if ((categories.length !== new Set(categories).size)) throw new Error('Repeated categories are not allowed');
categories.forEach(category => {
if (!allPossibleCategories.includes(category)) throw new Error(`${category} is not a valid category. Please make sure that the category name is lowercase. Valid Categories are: \n${allPossibleCategories}\n`);
if (!allPossibleCategories.map(category => { return category.name; }).includes(category)) throw new Error(`${category} is not a valid category. Please make sure that the category name is lowercase. Valid Categories are: \n${allPossibleCategories}\n`);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!allPossibleCategories.map(category => { return category.name; }).includes(category)) throw new Error(`${category} is not a valid category. Please make sure that the category name is lowercase. Valid Categories are: \n${allPossibleCategories}\n`);
if (!allPossibleCategories.map(category => { return category.name; }).includes(category)) throw new Error(`${category} is not a valid category. Please make sure that the category name is lowercase. Valid categories are: \n${allPossibleCategories}\n`);

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And also ${category.name} is not a valid category.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed these typo now.

@laurent22
Copy link
Owner

Any update here @Retr0ve? There's not much code but so many mistakes

@Retr0ve
Copy link
Contributor Author

Retr0ve commented Sep 6, 2022

Thx for checking. I've updated the code.

@@ -73,7 +73,7 @@ function validateCategories(categories) {
if (!categories) return null;
if ((categories.length !== new Set(categories).size)) throw new Error('Repeated categories are not allowed');
categories.forEach(category => {
if (!allPossibleCategories.includes(category)) throw new Error(`${category} is not a valid category. Please make sure that the category name is lowercase. Valid Categories are: \n${allPossibleCategories}\n`);
if (!allPossibleCategories.map(category => { return category.name; }).includes(category)) throw new Error(`${category.name} is not a valid category. Please make sure that the category name is lowercase. Valid categories are: \n${allPossibleCategories}\n`);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

throw new Error(`${category.name}

In fact it should be "category" here, not "category.name", isn't it? It doesn't look like you have tested or even read your code at all. I made a mistake by suggesting this change, but you need to be responsible for what you're doing and not rely on reviewers.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested and fixed now

@laurent22 laurent22 merged commit 6efe8c1 into laurent22:dev Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants