Solve [eslint] Delete 'cr' [prettier/prettier]
E
• Originally published at telingadigital.id

Solve [eslint] Delete 'cr' [prettier/prettier]

Here's how you can configure your
.prettierrc
and
.eslintrc.js
files to ensure consistent end-of-line handling in your project:

.prettierrc

json
1// .prettierrc
2{
3  "endOfLine": "auto"
4}

.eslintrc.js

javascript
1// .eslintrc.js
2module.exports = {
3  rules: {
4    'prettier/prettier': [
5      'error',
6      {
7        endOfLine: 'auto',
8      },
9    ],
10  },
11};

Explanation

  • The
    .prettierrc
    configuration sets the
    endOfLine
    option to
    "auto"
    , which will handle line endings based on the operating system.
  • The
    .eslintrc.js
    configuration integrates Prettier with ESLint, enforcing the same
    endOfLine
    setting as an ESLint rule, ensuring that code formatting remains consistent across your codebase.
1 min read