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

Disallow lines-between-class-members deletes comments and docblocks between methods #12391

Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion autofix This change is related to ESLint's autofixing capabilities bug ESLint is working incorrectly rule Relates to ESLint's core rules

Comments

@tomm1996
Copy link

tomm1996 commented Oct 8, 2019

Tell us about your environment
Windows 10/git bash

  • ESLint Version:
    6.5.1
  • Node Version:
    v11.9.0
  • npm Version:
    6.9.0

What parser (default, Babel-ESLint, etc.) are you using?
babel-eslint 9.0.0

Please show your full configuration:

Configuration
{
  "parserOptions": {
    "ecmaVersion": 2016,
    "sourceType": "module"
  },
  "rules": {
    "lines-between-class-members": [2, "never"]
  }
}

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

class MyClass {
    myMethod1 (param) {
    }
    
    /** 
     * test comment
     */
    myMethod2 (param) {
    }
}
eslint MyClass.js --fix

What did you expect to happen?
Remove line 4 in MyClass.js

What actually happened? Please include the actual, raw output from ESLint.
Removed lines 4-7 in MyClass.js

class MyClass {
    myMethod1 (param) {
    }
myMethod2 (param) {
    }
}

Are you willing to submit a pull request to fix this bug?
I suppose I'm not familiar enough with the code base to be of any help by now. I'd be willing to invest some time though.

@tomm1996 tomm1996 added bug ESLint is working incorrectly triage An ESLint team member will look at this issue soon labels Oct 8, 2019
@mdjermanovic mdjermanovic added accepted There is consensus among the team that this change meets the criteria for inclusion autofix This change is related to ESLint's autofixing capabilities rule Relates to ESLint's core rules and removed triage An ESLint team member will look at this issue soon labels Oct 8, 2019
@mdjermanovic
Copy link
Member

Hi @tomm1996, thanks for the report!

Confirmed in the Online Demo. This should be definitely fixed, just to see how.

There is lines-around-comment rule, so the solution might be to ignore class members if there is a comment between them, to avoid clashing. I'll try to check how some similar rules work in these situations.

@mdjermanovic
Copy link
Member

After thinking a bit about this, I agree with this comment by @kaicataldo that all these rules should be one single rule.

Was checking how padding-line-between-statements works when there are comments between and it seems there can be problems, e.g., this situation: Online Demo Link - one rule requires a line, while the other rule disallows the same line.

@yeonjuan
Copy link
Member

yeonjuan commented Dec 5, 2019

maybe. #12632 can fix it.

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Jun 19, 2020
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Jun 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.