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

Add new rule: remark-lint-consistent-linebreaks #292

Open
4 tasks done
remcohaszing opened this issue Jul 22, 2022 · 2 comments
Open
4 tasks done

Add new rule: remark-lint-consistent-linebreaks #292

remcohaszing opened this issue Jul 22, 2022 · 2 comments
Labels
👍 phase/yes Post is accepted and can be worked on 🙆 yes/confirmed This is confirmed and ready to be worked on

Comments

@remcohaszing
Copy link
Member

Initial checklist

Problem

Commonmark supports two ways to add a linebreak.

Using two spaces at the end of a line:

foo··
bar

Using a backslash at the end of a line:

foo\
bar

It would be nice if remark could enforce consistency.

Solution

Add a new rule: remark-lint-consistent-linebreaks

This rule enforces one style or the other, defaulting to \.

Alternatives

People shouldn’t use line breaks in the first place, but since they do, let’s prefer the visible one over the invisible one 🤷

@github-actions github-actions bot added 👋 phase/new Post is being triaged automatically 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Jul 22, 2022
@wooorm
Copy link
Member

wooorm commented Jul 23, 2022

Good idea!
I think it should be called remark-lint-hard-break-style:

  • The word “hard break” is more often used to differentiate from a soft line break, it’s also used for the existing rule remark-lint-hard-break-spaces
  • linebreak is used for the existing rule remark-lint-linebreak-style, which checks for CRLF/LF
  • the word “consistent” is used in this project as an option, which means that the first used style is chosen, and later uses should be the same. This is typically the default.

I think it should have the options:

  • 'consistent' (default)
  • 'escape' (accepting e.g. a\(?:\r|\r\n|\n)b)
  • 'trailing' (accepting e.g. a␠␠(?:\r|\r\n|\n)b)

@wooorm wooorm added 🙆 yes/confirmed This is confirmed and ready to be worked on 👍 phase/yes Post is accepted and can be worked on labels Jul 23, 2022
@github-actions github-actions bot removed the 🤞 phase/open Post is being triaged manually label Jul 23, 2022
@github-actions
Copy link

Hi! This was marked as ready to be worked on! Note that while this is ready to be worked on, nothing is said about priority: it may take a while for this to be solved.

Is this something you can and want to work on?

Team: please use the area/* (to describe the scope of the change), platform/* (if this is related to a specific one), and semver/* and type/* labels to annotate this. If this is first-timers friendly, add good first issue and if this could use help, add help wanted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👍 phase/yes Post is accepted and can be worked on 🙆 yes/confirmed This is confirmed and ready to be worked on
Development

No branches or pull requests

2 participants