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

New Rule: Sentences per line #317

Closed
1 task done
JoshuaKGoldberg opened this issue Feb 3, 2025 · 3 comments
Closed
1 task done

New Rule: Sentences per line #317

JoshuaKGoldberg opened this issue Feb 3, 2025 · 3 comments
Labels

Comments

@JoshuaKGoldberg
Copy link
Contributor

JoshuaKGoldberg commented Feb 3, 2025

Rule details

Enforce that each line of text has at most one sentence

What type of rule is this?

Warns about a potential problem

Example code

See spot. See spot run.

Participation

  • I am willing to submit a pull request to implement this rule.

Additional comments

I'd previously made https://github.com/JoshuaKGoldberg/sentences-per-line as a contributed rule for Markdownlint. IMO keeping to one sentence per line is a good practice. Copying from its README: sentences-per-line makes sure no line contains more than one sentence. This is useful because:

  • Shorter lines result in simpler, easier-to-understand Git diffs
  • Longer lines are harder to read in source code

We can define a "sentence" here as any characters followed by a text punctuation. Abc. would be a sentence; Abc. Def. and Abc! Def? would be two sentences.

I'd understand if this is too opinionated for @eslint/markdown core - but do want to propose at least providing it as a rule.

@nzakas
Copy link
Member

nzakas commented Feb 3, 2025

IMO keeping to one sentence per line is a good practice

It's funny, I have the exact opposite opinion on this. 😄

Is this something that Prettier can enforce?

@nzakas nzakas moved this from Needs Triage to Triaging in Triage Feb 3, 2025
@JoshuaKGoldberg
Copy link
Contributor Author

They chose not to in prettier/prettier#3302. The difficulty there was determining what constitutes a "sentence": prettier/prettier#3302 (comment).

This could be done as a Prettier plugin though, which I personally would be satisfied with. 🙂

@nzakas
Copy link
Member

nzakas commented Feb 4, 2025

Yeah, I have the same concern over what constitutes a sentence. I think a Prettier plugin is probably a better way to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Complete
Development

No branches or pull requests

2 participants