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

lint(exercises): check files.editor field for exercises #585

Merged
merged 2 commits into from
May 5, 2022
Merged

Conversation

ErikSchierboom
Copy link
Member

  • lint(validators): allow optional array of files
  • lint(exercises): check the validity of the files.editor field

This commit allows the `hasArrayOfFiles` function to work with optional
values.
This commit adds support for linting the `files.editor` field
in the `.meta/config.json` file of exercises.
## Returns true in any of these cases:
## - `hasArrayOfStrings` returns true for `data[key]`.
## - `data` lacks the key `key` and `isRequired` is false.
if data.hasKey(key, path, context, isRequired):
Copy link
Member

Choose a reason for hiding this comment

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

Do we need this line and extra indendation level? Can we use the below?

if hasArrayOfStrings(data, key, path, context, isRequired = isRequired)

Copy link
Member Author

Choose a reason for hiding this comment

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

No, because that'll return true if the field is not required and not present, which will cause the subsequent data[key] call to fail.

@ee7 ee7 merged commit 0832f81 into main May 5, 2022
@ee7 ee7 deleted the lint-editor-files branch May 5, 2022 14:39
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.

2 participants