8

I want to use double ("carriage return" || "Enter" key) to visually separate code-sections, and start new chaining form separate line (even if line length less then 80char).

But get an error: Delete ␍⏎eslint (prettier/prettier)

my code snippet:

router.param("id", checkId) //middleware to validate id
`␍`
`␍`
router.route("/")`␍`
  .get(getAllTours)`␍`
  .post(checkBody, createTour)

router.route("/:id")`␍`
  .get(getTour)`␍`
  .patch(updateTour)`␍`
  .delete(deleteTour)
`␍`
`␍`
module.exports = router

Tried: .eslintrc.json

'prettier/prettier': [
  'error',
  {
    'endOfLine': 'auto',
  }
]

Answer form https://stackoverflow.com/a/53769213/15580822

and also try the same in my config .prettierrc

All of this did not help. I'm getting the same error continuously...

I do not want to disable prettier completely.

But setting "endOfLine" in .eslintrc.json** ("off" - Never automatically format embedded code.) completely disable warnings from prettier

{ 
'endOfLine': 'off',
}

My question: what it actually does? Do I disable prettier completely?

I can not find an answer here or Google...

Any thoughts how to get rid of this error and still use prettier?

Denys Pugachov
  • 360
  • 1
  • 4
  • 9

2 Answers2

11

Answer is on the comments above, I had the same issue and after a bit of trial and error it was solved with:

On my .eslintrc.js

endOfLine: 'off'

And the .prettierrc.js

endOfLine: 'auto'

No more issues on the ESLint output, all works fine.

Alex Lillo
  • 571
  • 4
  • 7
-3

I solved it by deleting the two files .eslintrc.js and .prettierrc.js, and then just used the Prettier extension in vs code.

Squareman88
  • 263
  • 3
  • 6