Hey everyone! Has anyone else noticed that Claude Code sometimes just... ignores your project's prettier and eslint configs? I was so excited to have it help refactor a React component yesterday, but the formatting came out all wrongβdifferent quote style, wrong indentation, the whole thing. It was like it wasn't even looking at my `.prettierrc.json`.
After some trial and error (and a bit of frustration 😅), I found a couple of tricks that seem to work more consistently.
First, you **have to include the config file in the prompt**. Claude Code doesn't automatically read those files unless you explicitly ask it to. My workflow now looks like this:
* **Start by pasting the relevant config.** I'll open a chat and say something like: "Here is my project's `.prettierrc`:" and paste the contents.
* **Then, provide the file I want edited.** "Now, please refactor the following `Button.jsx` according to these rules:"
* **Be super specific in the instruction.** I add a line like: "Format the final output **strictly** according to the provided `.prettierrc` and `.eslintrc`."
It's an extra step, but it dramatically improves the accuracy. I've also found that sometimes you need to remind it mid-conversation if you're doing multiple rounds of edits.
A couple of other things I've noticed:
* For ESLint, pointing out a specific rule it missed (e.g., "please apply the `curly` rule") often gets better results than just saying "follow the eslintrc."
* It seems to work better if you keep the config files simple and avoid super complex extended configurations.
Does anyone have a smoother method? Have you gotten it to work seamlessly, or is manually providing the configs the only reliable way right now? Would love to hear your hacks!
βEmma