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
Change Request: Fix or remove code examples that require tabs #17629
Comments
Maybe we could represent tabs with something like |
Good idea, but a search for eslint/docs/src/rules/no-control-regex.md Line 70 in 68f1288
So maybe better something like |
If the concern is just what happens when opened in the playground, we could also add an option that hides the "Open in Playground" button. |
I think it's good to have a consistent visual presentation of tabs (e.g., |
Okay, I don't feel strongly about this, so happy to defer to what you're thinking. |
Err, what about ignoring with Edit: just to be clear, this is what @fasttime proposed in the OP 😄 I was confused why it wasn't being considered. |
That's what I had in mind when I suggested to selectively disable MD010/no-hard-tabs for some of the code examples, but there seems to be an argument that |
Thanks everybody for sharing your ideas. I have drafted a PR to show on different pages how things would look like after each of the suggested solutions, hopefully this will help us to better evaluate the results and take a decision.
Opinions? |
Thanks for putting those together! I'm definitely not a fan of the |
I'm in favor of visible characters as, in my opinion, examples would look better on the docs site, and there would be no problems with formatting markdown files. If Though, if others are strongly in favor of |
@mdjermanovic Can you show an example of a line with a right arrow character so I can update the PR? |
@mdjermanovic keep in mind that all of the rules where this matters will be deprecated, so I'm less concerned about them than I would otherwise. |
It looks like there's agreement on using tab characters with |
ESLint version
v8.51.0
What problem do you want to solve?
Some of our formatting rules have code examples that would have to contain tab characters in order to show the intended behavior. These code examples are currently messed up and it is not possible to fix them because Markdownlint forbids tabs and replaces them automatically with whitespaces in the lint-staged commit hook. The rules affected are at least:
indent
with optiontab
indent-legacy
with optiontab
max-len
with optiontabWidth
no-mixed-spaces-and-tabs
no-tabs
Out of those,
indent
andindent-legacy
are using a mix of whitespaces and comments like/*tab*/
to indicate a position where a tab is expected.max-len
andno-tabs
are using the sequence\t
which is a syntax error outside of literals.no-mixed-spaces-and-tabs
has whitespaces with explanatory comments on top. None of these workarounds behaves well in the Playground.What do you think is the correct solution?
I don't think we want to allow tabs in Markdown files, and the problematic rules are all going to be deprecated (
indent-legacy
is already), so the simplest approach would be removing the code examples that cannot work because tabs are not available.Alternatively we could selectively disable the Markdownlint rule that forbids tabs (MD010/no-hard-tabs) for some code examples, so we could put real tabs into them.
Or we could keep the broken code examples, declare them pseudocode, and remove the
:::correct
/:::incorrect
fences. This would remove the "Open in Playground" buttons and exempt the code blocks from validation when we will start to validate code examples.There are clearly other ways to address this, and there are possibly aspects I haven't considered, so I would like to hear what the team suggests.
Participation
Additional comments
No response
The text was updated successfully, but these errors were encountered: