Description
What version of eslint
are you using?
8.55.0
What version of prettier
are you using?
3.1.0
What version of eslint-plugin-prettier
are you using?
5.0.1
Please paste any applicable config files that you're using (e.g. .prettierrc
or .eslintrc
files)
https://stackblitz.com/edit/node-mhr6sb?file=README.md,eslint.config.js
What source code are you linting?
See the Stackblitz link above
What did you expect to happen?
With fine-grained files
option in the flat config, Prettier should be able to format virtual files created by eslint-plugin-markdown
to format the code snippet in Markdown.
What actually happened?
There is a hard-coded logic to ignore any virtual file created in markdown as well as a few other extensions:
eslint-plugin-prettier/worker.js
Lines 129 to 152 in 1882a36
I consider it a valid default as it might cause nested formatting when users enable eslint-plugin-prettier
to all files.
But with the new Flat Config, you are able to only enable certain rules with certain options for specific types of files. In the case where we don't config Prettier to format the parent markdown, treating the virtual files as normal formattable code should be allowed.
Proposed solutions
I imagine we could introduce a flag to opt-out of this hard-coded logic, and give the control of ignoring a file to users.
I made a simple implantation, adding a new config called fullControl
: a333607
Let me know if you have a better idea/naming. Thanks!