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

Support 'config' Option #689

Closed
wants to merge 1 commit into from
Closed

Support 'config' Option #689

wants to merge 1 commit into from

Conversation

colinta
Copy link

@colinta colinta commented Oct 18, 2024

Allows users to assign a custom path for the prettier config, ie a shared config in a monorepo.

Our use case is that we have a shared prettier config, but it doesn't live at the repository root.

Prettier supports this on the CLI using --config (and --ignorePath). This PR brings that feature to the eslint plugin.

e.g.

prettier --ignore-path config/prettier/prettierignore --config config/prettier/prettier.config.js --write src

Update: added a changelog w/ minor version bump.

Copy link

changeset-bot bot commented Oct 18, 2024

⚠️ No Changeset found

Latest commit: b1f3991

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Allows users to assign a custom path for
the prettier config, ie a shared config
in a monorepo
@colinta
Copy link
Author

colinta commented Oct 18, 2024

I was using this locally (yarn add --dev https://github.com/colinta/eslint-plugin-prettier) and I'm seeing this error:

Oops! Something went wrong! :(

ESLint: 8.57.0

TypeError: prettier.resolveConfig is not a function

I was able to fix it by patching the import in worker.js:

    if (!prettier) {
      const imported = await import("prettier");
      prettier = imported.default;
    }

But this change is unrelated to the config that I added. 🤔

@BPScott
Copy link
Member

BPScott commented Oct 21, 2024

I'm generally against adding new options to eslint-plugin-prettier as placing config files in non-standard locations is basically looking for trouble - its really hard to coordinate properly across CLIs and editor settings and people often end up blaming the wrong thing. As such, I want to avoid creating these non-blessed paths to stop people from thinking it might be a good idea.

@colinta is a fellow Shopify person. I've chatted to him through internal channels and we've came up with solution to his needs that avoids adding this option, and have confirmed that I'm good to close this PR.

@BPScott BPScott closed this Oct 21, 2024
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.

2 participants