Skip to content
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

Does not consider overrides defined in .prettierrc #656

Open
lmeysel opened this issue Apr 25, 2024 · 2 comments
Open

Does not consider overrides defined in .prettierrc #656

lmeysel opened this issue Apr 25, 2024 · 2 comments

Comments

@lmeysel
Copy link

lmeysel commented Apr 25, 2024

What version of eslint are you using?
8.57.0

What version of prettier are you using?
3.2.5

What version of eslint-plugin-prettier are you using?
5.1.3

Please paste any applicable config files that you're using (e.g. .prettierrc or .eslintrc files)
Using eslint flat config as provided in the docs (e.g. import prettier from 'eslint-config-prettier/recommended'

//  .prettierrc
{
  "printWidth": 80
  "overrides": [
    {
      "files": ["subfolder/**/*.ts"],
      "options": {
        "printWidth": 999
      }
    }
  }
}

What source code are you linting?

// src/foo.ts (normal prettierrc should apply)
console.log('Hello world. I am letting you know that this is a very long line, really exceeding the 80 chars and this should be wrapped by prettier');
// subfolder/bar.ts (overrides should apply)
console.log('Hello world. I am letting you know that this is a very long line, really exceeding the 80 chars but this should not be wrapped by prettier');

What did you expect to happen?
When I run prettier -w on the codebase, I see the overrides applied, e.g. the src/foo.ts is wrapped whereas the subfolder/bar.ts is written in one long line.

What actually happened?
When I run eslint --fix, I see the lines wrapped in both files. Additionally, VSCode shows an linting error in both files (while it should only show an error for the src/foo.ts.

@ReDrUm
Copy link

ReDrUm commented Oct 21, 2024

I'm seeing a similar issue in my project where prettier.format is invoked and passed the .prettierrc object for it's second parameter, but it's ignoring overrides specified in the object. The overrides work properly via the CLI, but not via the API. I assume the flaw is with prettier rather than eslint-plugin-prettier.

@Kludgy4
Copy link

Kludgy4 commented Dec 13, 2024

I am also encountering this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants