-
Notifications
You must be signed in to change notification settings - Fork 12
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
jsxBracketSameLine updated after deprecation #3
Conversation
PR for this issue to avoid the warning: npetruzzelli#2
Hello @npetruzzelli can we merge this PR? |
Thank you for commenting @alessio-libardi - its odd that this is the first email notification I've received about this for this repo. I didn't get one for @Serg4554 or @rotkiw I need to carefully consider how to handle versioning. Likely, I will be considering this a breaking change that requires a new major version (of the config, not of Prettier), since the config would no longer be compatible with Prettier versions For now it is a warning on Prettier's side and nothing is broken, since they deprecated it, they were able to release it on a minor version. I realize this may affect systems that may be strict enough to require zero errors and zero warnings of any kind, so I'll try to tackle this sooner rather than later. |
Thanks to you @npetruzzelli for taking the time to maintain this repo 🙌 By the way I'm not sure this should be a major, since updating I'm not sure I explaned too well so I'll make you an example: Given this package:
Locally you could format using Let me know what you think 😄 |
I would like to apologize for the delay. It continues to be a very busy time both in and out of work for me. My goal with this config is reliability and predictability, regardless of whether or not you are using exact versions or not and regardless of whether or not you are using a lock file. I look at config files a bit differently than modules or applications. If you are using a lock file, it should be committed to your repo and your CI process would then honor it. Both npm and Yarn have command line arguments to prevent the creation of lock files if you aren't using them. As long as someone uses a given major version of Prettier (2.x) and a major version of this config, then the results should be the same. I can't do anything for people using lower minor patches when new features are introduced in higher minor patches, but I can handle the reverse. There is a reason that settings are deprecated before being removed: 1) give consumers time to respond; 2) honor the contract of semantic versioning. If I remove the deprecated property and add its replacement in a minor or patch version, then users of lower versions of Prettier 2.x would revert to the default behavior instead of an explicitly defined behavior, and this would go against the spirit of the work done for issue #1 (and it is part of why it was broken up between multiple major versions of this config). There is a work around available until I get to this. You can extend this config using the instructions described in the README and manually remove the prop giving the warning and replace it with the new one. When I upgrade this config, it will be a major version upgrade. This won't matter to anyone using a lock file, since it will be a manual step to upgrade regardless of whether it is a major, minor, or patch version. New installs with // `prettier.config.js` or `.prettierrc.js`
const prettierConfigStandard = require('prettier-config-standard')
const modifiedConfig = {
...prettierConfigStandard,
bracketSameLine: true
}
delete modifiedConfig.jsxBracketSameLine
module.exports = modifiedConfig This should prevent warnings since the final config that gets consumed will not have the deprecated property defined at all. I have not (yet) checked whether or not deleting the deprecated property is needed or if simply defining the new property is enough. |
For context, I never install Prettier globally. Both my command line tools and code editor plugins use versions of Prettier local to the project I am working on. I don't think it affects the above, but it might help convey the scenario this config was built to thrive in. |
Hi @npetruzzelli, I appreciate that you spend your time considering the versioning to not break any existing project using your library! I agree with you about releasing a new major version, as minor versions are not supposed to break anything, but if you upgrade this library without upgrading So what if you define the dependency with "dependencies": {
"prettier": "^2.4.0"
} It shouldn't affect the build size of any project (as both, prettier and this project should be devDependencies) and makes explicit the dependency with prettier and the minimum required version, so when someone upgrades WDYT? Feel free to correct me if I made any wrong assumptions 🙂 |
Hello guys! My thoughts:
"peerDependencies": {
"prettier": "<2.4.0"
} My current solution: const { jsxBracketSameLine, ...prettierConfigStandard } = require('prettier-config-standard')
module.exports = {
// apply Standard formatting
...prettierConfigStandard,
// jsxBracketSameLine deprecated
bracketSameLine: jsxBracketSameLine, // current settings: true
} And of course, thank you @npetruzzelli for your great work! |
Hello @npetruzzelli ,I know the versioning needs careful consideration, but do we really think versioning is more important than the feature the libs itself provides? Shouldn't we just bump it for good at this point? Since the code is ready, doing semver philosophy around this it's not ideal, any way you will upgrade someone will still complain about the way we bumped the version and they'll eventually upgrade anyway if they need this config...there's just one thing we all have in common, we need this upgrade :) What do you think? By the way if you need help mantaining the repo I can definitely try to help 🙌 |
I'm with Alessio.
#3 (comment)
|
It has been a very busy year in work and out. Once more I apologize for taking so long for simple responses. I've finally got around to doing some local testing and some of what's being said here is making more sense as I get more context. Generally, when you deprecate something, the functionality continues to work until until it is removed in a major patch version. With Prettier 2.4, they did not just add a new option name in the form of
instead of
which we can probably expect in Prettier 3.x At least for Prettier@^2.4.0 both I can't say I agree with the approach Prettier took here. If you ignore the addition of For individual configs, it isn't a big deal. Update your config and you are good to go (because the feature still exists, if under a different name). For shareable configs, if you want make the claim that your major version will produce the same results across the same major version of the formatter, with minor versions only configuring new features and patch versions only fixing bugs, then you are put into a conflicting position.
@rotkiw 's workaround is great. Instead of relying on a hard coded work around value, it is flexible enough to update itself in the future, so long as the valid values for Because I've made the "produce consistent results" promise and Prettier 2.4.0 is a breaking change in that regard, then I have to abandon the hope of settling into a "one config major version per formatter major version" path. STEP 1: Moving forward, I will first add a peer dependency that requires With this in place, installers like npm and Yarn can provide meaningful messages during installation. The user doesn't have to wait until they try to use Prettier to get Prettier's own warning, which does not include versioning information. STEP 2: Afterwards, I will create a new major version that sets a peer dependency of Reference: @alessio-libardi - I appreciate the offer, but I haven't reached that point. If I were to consider that, then one blocker is I haven't put together any kind of "contributing" agreement/document just yet, and no one can fix that except me! While the majority of the community is fantastic and understand what open source contributions are, others can cause problems if something doesn't go the way they like. Until I can become more familiar with intricacies of the legal side of open source, my priority is to protect the code so that everyone can continue to use it! I may be overly worried about this because I watched it bring an open source Java project to a standstill. It has been so long that I don't remember the details, I just remember it was disheartening to watch. |
For anyone in the "I just need the update!" camp It is now available on npm as version 5.0.0: https://www.npmjs.com/package/prettier-config-standard |
PR for this issue to avoid the warning: #2