From f7e03e2133ac5583501ef5bc787370355d4fec67 Mon Sep 17 00:00:00 2001 From: aliraza556 Date: Sat, 4 Jan 2025 15:54:42 +0500 Subject: [PATCH] fix: standardize line endings for cross-platform development --- .gitattributes | 3 +++ .prettierrc.json | 3 ++- README.md | 27 +++++++++++++++++++++++++++ package.json | 3 ++- 4 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..314766e9 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +* text=auto eol=lf +*.{cmd,[cC][mM][dD]} text eol=crlf +*.{bat,[bB][aA][tT]} text eol=crlf diff --git a/.prettierrc.json b/.prettierrc.json index ddd52e34..75d6bdea 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -3,5 +3,6 @@ "tabWidth": 2, "printWidth": 100, "singleQuote": true, - "trailingComma": "none" + "trailingComma": "none", + "endOfLine": "lf" } \ No newline at end of file diff --git a/README.md b/README.md index 1e3a83cc..ebac2cd1 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,29 @@ If you wish to run only the frontend, follow these steps: - `yarn install` to install the dependencies - `yarn start` to run the frontend locally +## Fix Line Endings for Windows Development 🛠️ + +If you're developing on Windows and encounter line-ending issues with Prettier, you have two options: + +## Option 1: Fix Specific Files + +### Reset the Git index + git rm --cached -r . + git reset --hard + +### Configure Git to handle line endings + git config --global core.autocrlf false + git config --global core.eol lf + +### Run Prettier to fix formatting + - Example: + npx prettier --config .prettierrc.json -w src/store/interface.ts + +### Option 2: Fix All Files (Full Reset) +If you want to reset and fix all files in the project, you can use the provided script: + + yarn fix-line-endings + ## Contributing Guidelines 🤝 All code contributions, including those of people having commit access, must go through a pull request and be approved by a core developer before being merged. This is to ensure a proper review of all the code. @@ -87,6 +110,10 @@ If you wish to run only the frontend, follow these steps: - `yarn install` to install the dependencies - `yarn start` to run the frontend locally +## Fix Line Endings for Windows Development 🛠️ + +If you're developing on Windows and encounter line-ending issues with Prettier, run these commands: + ## Contributing Guidelines 🤝 All code contributions, including those of people having commit access, must go through a pull request and be approved by a core developer before being merged. This is to ensure a proper review of all the code. diff --git a/package.json b/package.json index 63450116..e5245e75 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,8 @@ "prepare": "husky install .husky", "test": "yarn run test-jest", "test-jest": "REACT_APP_IS_TEST=true NODE_ENV=test yarn jest --coverage --maxWorkers 2 --no-cache --transformIgnorePatterns \"./svg/\"", - "cypress:run": "npx cypress run" + "cypress:run": "npx cypress run", + "fix-line-endings": "git rm --cached -r . && git reset --hard && yarn prettier" }, "resolutions": { "react-error-overlay": "6.0.9",