![Solve [eslint] Delete 'cr' [prettier/prettier]](/_next/image?url=https%3A%2F%2Ftelinga-digital.s3-ap-southeast-1.amazonaws.com%2Fgallery%2F1730418355396-05a15826-2948-46f0-85e1-4d148c792a26-screenshot-2024-11-01-at-06.45.36.png&w=3840&q=75)
E
Endru Reza
Posted on Oct 31• Originally published at telingadigital.id
Solve [eslint] Delete 'cr' [prettier/prettier]
Here's how you can configure your and files to ensure consistent end-of-line handling in your project:
.prettierrc
.eslintrc.js
.prettierrc
json1// .prettierrc 2{ 3 "endOfLine": "auto" 4}
.eslintrc.js
javascript1// .eslintrc.js 2module.exports = { 3 rules: { 4 'prettier/prettier': [ 5 'error', 6 { 7 endOfLine: 'auto', 8 }, 9 ], 10 }, 11};
Explanation
- The configuration sets the
.prettierrc
option toendOfLine
, which will handle line endings based on the operating system."auto"
- The configuration integrates Prettier with ESLint, enforcing the same
.eslintrc.js
setting as an ESLint rule, ensuring that code formatting remains consistent across your codebase.endOfLine
1 min read