-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Fixed ESLint styling rules overriding Prettier styling rules #244
Conversation
@hkirat Although it may seem this PR (#244) and #243 are tackling the same issue - this PR is purely to solve the conflicting styling rules that are causing issues in CI (for a lot of PRs), and locally when using Husky pre-commit hooks. #243 is about resolving another issue and adds new features, while bringing a much larger diff/file changes. I believe the best case scenario would be to first merge this PR to ensure our GitHub Actions CI and Husky pre-commit hooks continue to do their jobs effectively, before merging other issues. |
@aryanprince how u are u solving this issue just removing ?
|
@TanmayDhobale Good question, it was very annoying during dev cus of our Husky pre-commit hooks - and being very annoying to debug as well. Video below shows an example of one of the conflicts caused by ESLint rule: Adding to this, every time someone makes a PR/commit, our Husky pre-commit rules will first apply Prettier formatting using Showcasing.ESLint.and.Prettier.Conflict.mp4Issue is having ESLint do any styling for us since Prettier already does a great job at that. It would be best to remove all of the ESLint styling rules we have to prevent any future conflicts. But the 2 rules I removed here were the only ones causing conflicts in this codebase currently. |
yea bcs i try many times but without changing files code lint problem is still there. then i have to change the file code automatically u can see here ive try to solve this issue in #211 but then u solved , great |
@aryanprince @TanmayDhobale do u know about extending eslint with prettier. It might be somewhat better than what we are doing currently |
@devsargam I 100% agree it's a better solution and it's what I gravitated towards at first. That's what I use in most of my personal projects. But I instead found out that I could solve the conflicts just by disabling the 2 ESLint styling rules for now, instead of introducing a new dependency (like @TanmayDhobale Feel free to include |
Not sure let's see |
@aryanprince there are a few edge cases where your approach might not work everytime. But one thing, after removing those 2 options now eslint won't provide rules for indentation in this project. This issue solves a big problem but accidentally starts another small one cc @TanmayDhobale please look into it!!! |
I agree. But we are better off with ESLint not providing rules for indentation, since Prettier will auto format the files anyways - especially with the Husky pre-commit hooks in place.
Could you provide some examples where this could start other problems? Currently, all of our other ESLint styling rules (in |
@aryanprince I don't remember much brother. But I did see some weird behaviour when it was a case for nested ternaries true ?
true ?
"yes" : "no"
: "something" I just know this because I raised an issue way earlier #23 |
after reviewing our current setup and the discussions around ESLint and Prettier conflicts, I suggest integrating eslint-config-prettier as a more sustainable solution. This approach will systematically disable all ESLint rules that could conflict with Prettier, ensuring a smoother workflow without needing to manually disable specific rules. It not only simplifies our setup but also enhances maintainability and minimizes potential issues down the road. let me know pls @devsargam @aryanprince |
@TanmayDhobale sure go on. For now @aryanprince solution seems fine as it's blocking the turoborepo migration |
@devsargam @TanmayDhobale I fully agree, can totally see this happening. Best case scenario would be to update our ESLint config to use
True, this minimal ESLint config change is the smallest possible change I could do to ensure the Turborepo migration goes smoothly. |
yeah, linting is always tedious and should happen when the pr count is almost 0 else cause a lot of merge conflicts. Upto then you guys keep comitting with --no-verify flag which wont trigger husky |
Agreed, let’s prioritize minimizing merge conflicts by holding off on sweeping lint changes until our PR count is low. Using --no-verify temporarily seems like the best path forward. We’ll circle back to eslint-config-prettier integration later. |
@devsargam yoo whtats ur discord ? or maybe check ur twitter dm once |
Summary
This fixes the minor issue where ESLint's styling rules were overwriting the Prettier styling rules. Videos below showcase an example.
This PR is part of the Turborepo monorepo migration mentioned in #234.
EDIT: Comment below in this PR (here) showcases an example of the conflicting styling rules caused before this PR.
Changes
Showcase
Before Changes
👇 Shows how the
lint:fix
script overrides changes done byformat:fix
Before.Changes.mp4
After Changes
👇 ESLint (
lint:fix
) no longer conflicts with Prettier's (format:fix
) styling changes nowAfter.Changes.mp4