0

I'm using prettier and Eslint, However there is a format conflict between them.

My Eslint has a rule that set a blank line between imports:


 "padding-line-between-statements": [
      "error",
      {
        "blankLine": "always",
        "prev": "import",
        "next": "import"
      },
...
]

Which gives this format:

enter image description here

However, when I save my file which applies a prettier rules it removes these empty line and it becomes like this:

enter image description here

.prettierrc

{
  "plugins": ["@trivago/prettier-plugin-sort-imports"],
  "printWidth": 120,
  "trailingComma": "es5",
  "semi": false,
  "tabWidth": 2,
  "singleQuote": false,
  "jsxSingleQuote": true,
  "jsxBracketSameLine": false,
  "jsxIndent": 2,
  "jsxSortProps": true,
  "arrowParens": "always",
  "useTabs": false,
  "importOrder": ["^@/redux/(.*)$", "^@/components/(.*)$", "^[./]"],
  "importOrderSeparation": true,
  "importOrderSortSpecifiers": true,
  "importOrderCaseInsensitive": true
}

  • Prettier is pretty opinionated and does not allow for customization really, they [mention this on their philosophy page](https://prettier.io/docs/en/option-philosophy). If you truly want to do something that goes against Prettier, you might as well not use Prettier at all. – Chris Barr Aug 31 '23 at 17:30

0 Answers0