Denys Pugachov
Denys Pugachov

Reputation: 500

Get rid of error: Delete `␍⏎` eslint (prettier/prettier), and allow use double `cr` Visual Studio Code1.56.2 on Windows 10

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?

Upvotes: 17

Views: 35351

Answers (4)

Ray
Ray

Reputation: 43

On .eslintrc.js :

  ignorePatterns: ['.eslintrc.js'],

add "*" like this :

  ignorePatterns: ['.eslintrc.js',"*"],

works fine !

Upvotes: 1

Dárcio Carvalho
Dárcio Carvalho

Reputation: 71

In your .eslintrc.json, set like this:

...
"prettier/prettier": [
            "error", 
            {
              "endOfLine": "off"
            }
        ]
...

after this, the ESLint don't send issues about this.

Upvotes: 7

Squareman88
Squareman88

Reputation: 261

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

Upvotes: -4

Alex Lillo
Alex Lillo

Reputation: 731

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.

Upvotes: 27

Related Questions