-
Notifications
You must be signed in to change notification settings - Fork 5
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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
)
prettier-config/package.json
Outdated
"files": [ | ||
"*.json", | ||
"*.md" | ||
], | ||
"exports": "./index.js", |
There was a problem hiding this comment.
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",
}
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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.