-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[core] Enforce straight quote #34686
Conversation
@@ -48,7 +48,7 @@ function runPrettier(options) { | |||
}); | |||
|
|||
const files = glob | |||
.sync('**/*.{js,jsx,md,tsx,ts,json,html,css,prisma,yml}', { | |||
.sync('**/*.{js,jsx,md,tsx,ts,cjs,mjs,json,html,css,prisma,yml}', { |
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.
mjs
is used in https://github.com/mui/material-ui/blob/d3010f1599af56b3b1dd9e576b27d5b91d760e9f/scripts/generateCodeowners.mjs
cjs
was introduced in this PR.
@@ -0,0 +1,28 @@ | |||
const straightQuotes = require('./packages/markdownlint-rule-mui/straight-quotes'); | |||
|
|||
module.exports = { |
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.
This new configuration file is still compatible with https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint.
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'm OK with this change in general. Got just one comment.
It's worth letting @samuelsycamore know about this.
CHANGELOG.md
Outdated
@@ -376,7 +376,7 @@ _Aug 22, 2022_ | |||
|
|||
A big thanks to the 11 contributors who made this release possible. Here are some highlights ✨: | |||
|
|||
- ✨ @michaldudak synced the Material Icons set with the latest from Google (#33988). | |||
- ✨ @michaldudak synced the Material Icons set with the latest from Google (#33988). |
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.
This change is unrelated. Is there any specific reason for it?
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.
@michaldudak I have VS Code configured to automatically remove trailing space on save, e.g. of a value: https://github.com/mui/mui-x/pull/6242/files#r990690291.
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.
This shouldn't apply to markdown as trailing whitespace is meaningful there.
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.
as trailing whitespace is meaningful there.
@michaldudak Would this be better b88ed0d? The existence of line break is not obvious to identify on HEAD:
Lines 379 to 380 in e4c5bff
- ✨ @michaldudak synced the Material Icons set with the latest from Google (#33988). | |
A couple of icons changed their appearance. See the difference [on this Argos build](https://app.argos-ci.com/mui/material-ui/builds/4428]). |
I think that it would be better with <br>
to be able to predict how the markdown will render at first look. https://github.github.com/gfm/#hard-line-breaks also mentions that \
is available.
On this topic, I think that "GitHub release" is buggy, it adds a line break for a \n
in the markdown but should it be for \n\n
? For example, https://github.com/mui/material-ui/blob/master/CHANGELOG.md#muibase500-alpha98 is not the same as https://github.com/mui/material-ui/releases/tag/v5.10.6. WUT? I have opened community/community#35750.
I think that we can enable https://github.com/updownpress/markdown-lint/blob/master/rules/009-no-trailing-spaces.md next 😁
diff --git a/.markdownlint-cli2.cjs b/.markdownlint-cli2.cjs
index 78ba7deec3..0b423d3689 100644
--- a/.markdownlint-cli2.cjs
+++ b/.markdownlint-cli2.cjs
@@ -4,6 +4,7 @@ module.exports = {
config: {
default: true,
MD004: false, // MD004/ul-style. Buggy
+ MD009: true, // MD009/no-trailing-spaces
MD013: false, // MD013/line-length. Already handled by Prettier.
MD014: false, // MD014/commands-show-output. It's OK.
MD024: { siblings_only: true }, // MD024/no-duplicate-heading/no-duplicate-header
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 personally prefer the cleanliness of trailing spaces, but an HTML tag is acceptable as well.
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.
cleanliness of trailing spaces
I have updated my previous comment, I think that the issue is with predictability.
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.
The markdown document ideally should be well readable both as plain text and rendered. The inclusion of an HTML tag (<br />
) harms the reading flow. The \
character could be a bit better in this context.
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 done the change from <br>
to \
and pushed, it works https://github.com/mui/material-ui/blob/1108af61b61eeffdb0ee4b9149668ccde624a4a3/CHANGELOG.md#5102.
I think that for the markdown, it's more important to be able to predict how the source will render, as ultimately the rendered markdown will be read x10?, x100? more than the markdown source. So I think that <br>
is clearer than \
, but \
is already much clearer than a double space, so deal 😁.
Great idea, we started a discussion about it at https://www.notion.so/Style-guide-2a957a4168a54d47b14bae026d06a24b?d=aff8a8dc579c48f8a2500de4253c6949#b17ab6d6eb6f4589ba084207caf33443. In the worse case, if we don't want to enforce this quote style rule, points 2. and 3. are still wins :) |
Do you mean "enforce straight quotes"? It looks like that's what this is doing—replacing all curly quotes with straight quotes. I'm cool with that. 👍 |
The objective of this change is to:
I had to move from
markdownlint-cli
tomarkdownlint-cli2
which is from the same author, but with extra features.