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

Add fileInfoOptions to override options passed to prettier.getFileInfo #217

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

making3
Copy link

@making3 making3 commented Jan 4, 2022

This change is meant to add a similar option as the eslint-plugin-prettier package, allowing developers to pass options to prettier.getFileInfo.

Our team's use case is that we are running Stylelint through the Node.js API, but targeting specific directories that each have their own .prettierignore configuration. Since our script isn't in each of these directories, the incorrect .prettierignore is grabbed (i.e. it's looking at where the script is running by default).

I did not create an issue for this, but let me know if you prefer having an issue to link or any other guidelines. I didn't see a whole lot on the contributing guidelines, but happy to update anything.

See the eslint-plugin-prettier PR here for the related PR on the ESLint side.

"rules": {
"prettier/prettier": [
true,
{"fileInfoOptions": {"ignorePath": "../../.prettierignore"}}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small note - ESLint has a third "slot" for options, I did not find a similar pattern for Stylelint, but I may just be not as familiar.

Theirs looks like this:

"prettier/prettier": ["error", { /* this is where Stylelint configures fileInfoOptions instead */ }, {
  "fileInfoOptions": {
    "withNodeModules": true
  }
}]

Let me know if there is a preferred approach instead.

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

Successfully merging this pull request may close these issues.

1 participant