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

Closed
tomm1996 opened this issue Oct 8, 2019 · 3 comments · May be fixed by nl253/BlogUI#3, yowainwright/learn-redux#7, O330oei/node#4, O330oei/botany-#7 or O330oei/DROID.DR#3

Comments

@tomm1996
Copy link

@tomm1996 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.

@mdjermanovic

This comment has been minimized.

Copy link
Member

@mdjermanovic mdjermanovic commented Oct 8, 2019

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

This comment has been minimized.

Copy link
Member

@mdjermanovic mdjermanovic commented Oct 8, 2019

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

This comment has been minimized.

Copy link
Member

@yeonjuan yeonjuan commented Dec 5, 2019

maybe. #12632 can fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.