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

Should we keep no-inline-comments ? #67

Open
ThaNarie opened this issue Mar 3, 2023 · 1 comment
Open

Should we keep no-inline-comments ? #67

ThaNarie opened this issue Mar 3, 2023 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@ThaNarie
Copy link
Member

ThaNarie commented Mar 3, 2023

Consider the following example code:

const obj = {
  a: 1,
  b: true,
  c: 'string', // this one is special
}

The inline comment there is not allowed, instead, it expects you to move it above it:

const obj = {
  a: 1,
  b: true,
  // this one is special
  c: 'string',
}

While in general I appreciate what it tries to prevent:

  • prevent long lines with comments (prettier doesn't wrap inline comments)
  • prevent inconsistency of where comments are located in code, so it's easier to scan it

However, often in cases when having a more structured code (like options objects) with small annotation comments, it really gets in the way.

👍 = keep
👎 = remove
👀 = no opinion

@ThaNarie ThaNarie changed the title Should we remove no-inline-comments ? Should we keep no-inline-comments ? Mar 3, 2023
@ThaNarie ThaNarie added the help wanted Extra attention is needed label Mar 3, 2023
@leroykorterink
Copy link
Collaborator

I don't think we should allow inline comments, I prefer the consistency of all comments on a new line.

In what scenario are small annotation comments really necessary? If a comment is really that small, shouldn't it be part of the variable name instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants