Deprecate slots, attributes and syntax#2208
Conversation
jovyntls
left a comment
There was a problem hiding this comment.
Thanks @itsyme !
Would you mind looking into deprecating these as well? If they're related to the current deprecation issue they can be deprecated; if they are not related, we can document any possible changes in (user-facing) behaviour and update the migration information
packages/core/src/html/warnings.ts
Outdated
| 'modal-header': 'header', | ||
| 'modal-footer': 'footer', | ||
| }); | ||
| _warnDeprecatedSlotNames(node, {}); |
There was a problem hiding this comment.
We can remove this method entirely since we'll no longer have deprecated slot names 🎉
| isNotTextWithoutKeywords() { | ||
| return !(this.isTextQuestion() && !this.keywords); |
There was a problem hiding this comment.
This method name is quite confusing with a double negation (and then a triple negation above when we are negating it to be assigned to const isTextWithoutKeyword above) 😅 Can we rename this? Maybe isTextWithoutKeyword where it can be used directly?
packages/core/src/html/warnings.ts
Outdated
| }); | ||
| }, | ||
| }; | ||
| export const warnDeprecatedAtributesMap: { [attr: string]: (nd: MbNode) => void } = {}; |
There was a problem hiding this comment.
Same for this - let's remove it entirely
packages/core/src/html/warnings.ts
Outdated
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
| function _warnDeprecatedSlotNames(element: MbNode, namePairs: { [name: string]: string }) { |
There was a problem hiding this comment.
We should be able to remove this function entirely as well! 🎉
If we need it again (hopefully never), we can recover it from the history :)
| `; | ||
|
|
||
| export const PROCESS_MODAL_SLOTS_RENAMING_EXPECTED = ` | ||
| module.exports.PROCESS_MODAL_SLOTS_RENAMING_EXPECTED = ` |
There was a problem hiding this comment.
This should be removed as well - it's the expected output of the removed test case
There was a problem hiding this comment.
LGTM! One last thing, can we update the issue description to be more informative to anyone who might be migrating?
To migrate:
Modal: modal-header -> header, modal-footer -> footer
Question: hasInput -> type="text", Invalid question types (invalid type attribute) now not supported
Icons: {{ }} -> : :
e.g. details could include:
- what
modal-headeris (slot/attribute/etc) - what users can do if they are currently using an invalid question type that is no longer supported
- any other helpful information
Ideally we should be able to put it in the release notes to help users migrating from v4 to v5 :)
Hi @jovyntls! I've edited the description! Do let me know if it is alright or if there is anything that could be improved! |
|
@itsyme Would you like to merge this PR? Remember to use the squash-merge strategy and to add the proposed commit message in the description :) Feel free to merge it after a second approval has been given, or after 24 hours (following the DG project management guidelines) |
What is the purpose of this pull request?
Overview of changes:
Resolves #1854. Fully deprecated Modal:
modal-header,modal-footer, Question:hasInput, invalid question types (invalidtypeattribute), Icons:{{ }}syntax.modal-headerandmodal-footerin Modal,hasInputand invalid question types (invalidtypeattribute) in Question,{{ }}syntax in icons have been fully deprecatedTo migrate:
Modal:
modal-header->headermodal-headerattribute has been fully deprecatedmodal-headerattribute with justheaderwith the text in the attribute unchanged<modal modal-header="HEADER TEXT">to<modal header="HEADER TEXT">modal-footer->footermodal-footerattribute has been fully deprecatedmodal-footerattribute with justfooterwith the text in the attribute unchanged<modal modal-footer="FOOTER TEXT">to<modal footer="FOOTER TEXT">Question:
has-input->type="text"has-inputattribute has been fully deprecatedhas-inputattribute withtype="text"<question has-input>to<question type="text">typeattribute) now not supportedmcq,checkbox,blanks,textIcons:
{{ }}->: :{{and}}to:{{emoji-name}}to:emoji-name:Anything you'd like to highlight/discuss:
Testing instructions:
Proposed commit message: (wrap lines at 72 characters)
Deprecate slots, attributes and syntax
Modal:
modal-header,modal-footer, Question:hasInput,invalid question types (questions without input fields), Icons:
{{ }}syntax are supported.
This could be confusing for users as it is not standardised and some
slots, attributes or syntax are not mentioned in documentation.
Let's fully deprecate these slots, attributes and syntax fully and
remove them from documentation.
This prevents confusion for users by standardising the slots,
attributes and syntax to use, which is made clear in documentation.
Checklist: ☑️