You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While working on #275 I came across a few things I would like to discuss.
Prettier vs. Markdownlint
As per .vscode/extensions.json both Prettier and markdownlint are recommended extensions. I assume their usage is encouraged?
The indent_size = 4 specified in .editorconfig is respected by Prettier, since it parses it into it's own config.
However, the default rule-set of markdownlint is not compatible with the resulting format.
This causes linting issues after formatting with Prettier, especially with nested lists mixing unordered and ordered list:
I tried to define a compatible ruleset as suggested here.
Yet, this does not solve the issue. Even with manually tweaking the rules values:
It seems to me that Prettier uses more complex conditional formatting than what can be specified with markdownlint's rule-sets.
Current State
Currently almost none of the markdown files in this repository conform to either format:
$ prettier -c ./content
Checking formatting...
[warn] content/de/_index.html
...
[warn] content/en/storage-backup/s3-storage/tutorials/versioning-in-s3.md
[warn] Code style issues found in 524 files. Run Prettier with --write to fix.
If we want to enforce consistent formatting I would suggest that we:
Choose one of Prettier/markdownlint. (Or discover a solution I didn't find.)
Don't have the rules inferred by letting the formatter parse the .editorconfig. This is really annoying to debug.
Explicitly specify the formatting rules in an appropriate configuration file for the formatter.
Be it a .markdownlint.json or a .prettierrc.
Don't set the extension as recommended, but preinstall it via devcontainer.json:
"customizations": {
"vscode": {
"extensions": [
"esbenp.prettier-vscode"
],
"settings": {
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true// This might be a little too intrusive for some?
}
}
}
Maybe even add a lint job to the existing workflows?
This would guarantee only properly formatted code being merged.
While working on #275 I came across a few things I would like to discuss.
Prettier vs. Markdownlint
As per
.vscode/extensions.json
both Prettier and markdownlint are recommended extensions. I assume their usage is encouraged?The
indent_size = 4
specified in.editorconfig
is respected by Prettier, since it parses it into it's own config.However, the default rule-set of markdownlint is not compatible with the resulting format.
This causes linting issues after formatting with Prettier, especially with nested lists mixing unordered and ordered list:
I tried to define a compatible ruleset as suggested here.
.markdownlint.json:
Yet, this does not solve the issue. Even with manually tweaking the rules values:
It seems to me that Prettier uses more complex conditional formatting than what can be specified with markdownlint's rule-sets.
Current State
Currently almost none of the markdown files in this repository conform to either format:
Suggestions
If we want to enforce consistent formatting I would suggest that we:
Choose one of Prettier/markdownlint. (Or discover a solution I didn't find.)
Don't have the rules inferred by letting the formatter parse the
.editorconfig
. This is really annoying to debug.Explicitly specify the formatting rules in an appropriate configuration file for the formatter.
Be it a
.markdownlint.json
or a.prettierrc
.Don't set the extension as recommended, but preinstall it via
devcontainer.json
:Maybe even add a lint job to the existing workflows?
This would guarantee only properly formatted code being merged.
Conclusion
I think that to conform to what we defined for ourselves in
./guidelines
, we need to ensure a consistent style/format.Let me know what you think and feel free to suggest entirely different approaches.
The text was updated successfully, but these errors were encountered: