Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete `␍`eslintprettier/prettier

Before you mash the duplicate button, I know there are more posts on the same issue and I've tried the solutions to no avail (Please see the last part of my post).

I'm using React 17.0.2, ESLint 8.5.0 and Prettier 2.5.1 and I'm getting the following error in almost every js file.

Delete `␍`eslintprettier/prettier

This is what it looks like

enter image description here

This is my .eslintrc.json:

{
    "env": {
        "browser": true,
        "es2021": true
    },
    "extends": [
        "eslint:recommended",
        "plugin:react/recommended",
        "plugin:prettier/recommended"
    ],
    "parserOptions": {
        "ecmaFeatures": {
            "jsx": true
        },
        "ecmaVersion": 13,
        "sourceType": "module"
    },
    "plugins": [
        "react"
    ],
    "rules": {
        "react/react-in-jsx-scope": "off"
    }
}

I followed this guide to add ESLint and Prettier to my project

https://medium.com/how-to-react/config-eslint-and-prettier-in-visual-studio-code-for-react-js-development-97bb2236b31a

I've tried almost every suggestion from another post about the same issue to no avail...

Why do I keep getting Delete 'cr' [prettier/prettier]?

I've used

git config --global core.autocrlf false

Deleted my project and cloned it again a few times, but no change. I've also tried some of the other suggestions where they edit .eslintrc.json but it either doesn't work or breaks my autoformat.

I'm out of ideas and spent way too much time on this, can anyone tell where I'm going wrong?

like image 891
SJ19 Avatar asked Feb 15 '26 08:02

SJ19


2 Answers

You could easily fix that issue.

In .eslintrc.json file, you should configure rules option.

Add the following configuration and it will fix the problem.

"prettier/prettier": ["error", { "endOfLine": "auto" }]
like image 157
Alan Zhu Avatar answered Feb 17 '26 20:02

Alan Zhu


Many editors let you change between CRLF and LF line-ending modes. On VSCode this is a toggle on the bottom menu bar which switches when clicked.

The change the default for all files, edit settings.json and add the following at the top:

For default LF:

{
    "files.eol": "\n",
}

For default CRLF:

{
    "files.eol": "\r\n",
}
like image 45
match Avatar answered Feb 17 '26 22:02

match



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!