Search code examples
visual-studio-codeformattingeslintprettier

Prettier and ESLint jQuery spacing


I have code that when formatted with Prettier ESLint gives me an error

ORIGINAL:

  $(document).trigger('HideDropDown').trigger('UpdateDropDowns');

FIXED with Prettier

  $(document)
    .trigger('HideDropDown')
    .trigger('UpdateDropDowns');

ESLINT complains that I need extra spaces as such:

  $(document)
      .trigger('HideDropDown')
      .trigger('UpdateDropDowns');

Is this something that needs to be adjusted through Prettier or ESLint? I do prefer only two spaces rather than 4 but I am not sure how to adjust it so that ESLint doesn't complain about it.


Solution

  • In my case I figured out that the following setting would allow ESLint and Prettier work together well:

    "MemberExpression": 1 // default is 2