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

Stylelint Formatter: ruleMetadata Safe Navigation #113

Merged
merged 1 commit into from
Feb 5, 2024

Conversation

bert-mccutchen
Copy link
Contributor

Why?

Solves issue #112

I had predicted that a rule may not exist in the rule metadata. However, I did not predict that the entire ruleMetadata object could be undefined when referencing the Stylelint custom formatter documentation.

I believe this to actually be a bug from the Stylelint source, where it is not handling a potentially undefined result when accessing lintResult._postcssResult.stylelint.ruleMetadata:
https://github.com/stylelint/stylelint/blob/15.11.0/lib/prepareReturnValue.js#L74

What

Added extra safe navigation to ensure that ruleMetadata is not undefined/null before attempting to access it.

Copy link
Contributor

github-actions bot commented Feb 4, 2024

🏷️ [bumpr] Next version:v1.20.1 Changes:v1.20.0...reviewdog:stylelint-ruleMetadata-safe-nav

Copy link
Member

@haya14busa haya14busa left a comment

Choose a reason for hiding this comment

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

Cool. Thank you for the quick fix 👍

@haya14busa haya14busa merged commit 4a97984 into master Feb 5, 2024
6 checks passed
Copy link
Contributor

github-actions bot commented Feb 5, 2024

🚀 [bumpr] Bumped! New version:v1.20.1 Changes:v1.20.0...v1.20.1

@bert-mccutchen bert-mccutchen deleted the stylelint-ruleMetadata-safe-nav branch February 5, 2024 00:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants