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

refactor: prettier-config from json to js #18

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

Conversation

grantwforsythe
Copy link

This was done so that the base config is extensible which will allow other projects to install any prettier plugins that might be relevant for their project, e.g. prettier-plugin-tailwind.

Copy link
Member

@spike-rabbit spike-rabbit left a comment

Choose a reason for hiding this comment

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

I think this makes sense 👍

Just one additional note regarding the commit note. I think in the scope of this repository, this change is a feature. So a commit message like this would be nicer:

feat(prettier-config): additionally export config as .js

Unlike the current .json config, the .js config can be imported and
extended.

Please also update the README.md to show this way of using it:

"prettier": "@siemens/prettier-config", (without /.prettierrc.json)

"files": [
"*.json",
"*.md"
],
"exports": "./index.js",
Copy link
Member

Choose a reason for hiding this comment

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

this breaks current configuration. Since I do not see any reason for the *.md export I think we could do this:

  "exports": {
    ".": "./index.js",
    "./.prettierrc.json": "./.prettierrc.json"
  },

That way you can use this in your app as:

{
  "prettier": "@siemens/prettier-config",
}

Copy link
Author

Choose a reason for hiding this comment

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

Given that there is only one entry point in to the package, we can just remove .prettierrc.json and use main which has a default value of index.js

Copy link
Member

Choose a reason for hiding this comment

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

yes, but this is breaking the current way of using it.

Projects currently have prettier: '@siemens/prettier-config/.prettierrc.json'. This will stop working if we no longer export this in the package.json. So the idea would be to keep both for a while until we anyway need to break things. Then we can remove the prettierrc.json and the related export.

Copy link
Author

@grantwforsythe grantwforsythe Feb 5, 2025

Choose a reason for hiding this comment

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

That sounds reasonable to me. I have added back the rc file

This was done so that the base config is extensible which will allow
other projects to install any prettier plugins that might be relevant
for their project, e.g. prettier-plugin-tailwind.
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