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 autofix to font-family-name-quotes #5806
Add autofix to font-family-name-quotes #5806
Conversation
- add test for rule option `always-unless-required`
- add tests for `always-where-recommended` config option
- add test for `always-where-required` config option
@MrBrN197 Thank you for creating the pull request and sorry for the late response.
With the current implementation, stylelint/lib/lintPostcssResult.js Lines 57 to 61 in 8a4253a
Line 8 in 8a4253a
This behavior is undocumented as far as I know and may be changed in the future. However, since it will be as-is for a while, I recommend removing the code referring So, it doesn't seem to be a big problem, even if
OK, I'll review the code more. |
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.
[suggest] Can you please add the following description to the font-family-name-quotes
doc?
The [`fix` option](../../../docs/user-guide/usage/options.md#fix) can automatically fix most of the problems reported by this rule. |
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.
[suggest] Can you move fixed:
next to code:
like other cases?
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.
@MrBrN197 I've left some suggestions. I would appreciate them if you could consider them. 😃
@MrBrN197 Thanks for the pull request.
Yes, let's always fix with double quotes. It's what the standard config uses because double quotes are most commonly used in the specification examples. |
font-family-name-quotes
rule
@MrBrN197 Thanks for making those changes. Can you also implement @ybiquitous' two suggestions above, and then I think we'll be ready for a final review? |
@jeddy3 Hey, Thanks, Yes I'm getting on the other changes. |
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.
@MrBrN197 Thank you and sorry for the late response. Great work. 👍🏼
I've left some easy refactoring suggestions, so please consider them.
Replace `() => void` with `function` Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com>
add return type Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com>
Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com>
Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com>
Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com>
@ybiquitous Thanks for the feedback. I've made those changes. |
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.
@MrBrN197 Great! LGTM 👍🏼
I think we need to mark the rule as |
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.
@MrBrN197 Thank you! LGTM.
Changelog entry:
|
Closes #5805
result
object to check against thestring-quotes
rule to determine whether to replace with single or double-quotes. I'm not sure whether this is wise or not. I'm not sure what order the rules run in so if thefont-family-name-quotes
rule runs after thestring-quotes
this might cause it to replace with the wrong type of quotes andstring-quotes
will not get a chance to fix this.checkFamilyName
returns an object whencontext.fix
is enabled andcomplain
doesn't run. modifying thedecl.value
insidecheckFamilyName
would result in the otherfontFamilyNode.sourceIndex
s' being wrong so I defer this until after the loop. I'm not sure if this is the best way to go about this. but to avoid rewriting a lot of the code this is what I decided to do. some clarification on this would be nice.