Search code examples
typescripteslinttypescript-eslinteslintrcprettier-eslint

Problem with disabling rule "lines-between-class-members" eslint


In my project (playwright + ts) I used a eslint to checking my code. I have problem with one rule 'lines-between-class-members'.

I don't want to use it, so according to documentation in .eslintrc.json file I add 'off'

    "lines-between-class-members": "off",

I tried also with value 0, but it also does not working.

E.g. I see error for 2-nd, 3-th variables. 'ESLint: Expected blank line between class members.(@typescript-eslint/lines-between-class-members)' when they are not empty line between.

private var1;
private var2;
private var3

But if I changed value 'off' to 'warn' it is working, instead of error I'm getting warning.

Do you have some suggestions how I could resole my problem. :) Thanks for any tips :)


Solution

  • Just tried the same ESLint rule on a Playwright project and can confirm the erroneous behaviour, setting it to off will still report violations of the lines-between-class-members rule. When running ESLint from the command line with the rule set to off, warning or error, the setting is taken into account however. Looks like the problem is the ESLint plugin in VS Code, which seems to ignore the setting for this specific rule. Switching it off can also be obtained by removing this rule as a workaround though.

    To my surprise the ESLint plugin worked correctly again after having closed VS Code and opening it again. This also happens now and then with other added and initially misbehaving rules.