Skip to content

Deprecate slots, attributes and syntax#2208

Merged
itsyme merged 22 commits intoMarkBind:masterfrom
itsyme:deprecate-1845
Mar 25, 2023
Merged

Deprecate slots, attributes and syntax#2208
itsyme merged 22 commits intoMarkBind:masterfrom
itsyme:deprecate-1845

Conversation

@itsyme
Copy link
Contributor

@itsyme itsyme commented Mar 13, 2023

What is the purpose of this pull request?

  • Documentation update
  • Bug fix
  • Feature addition or enhancement
  • Code maintenance
  • DevOps
  • Improve developer experience
  • Others, please explain:

Overview of changes:
Resolves #1854. Fully deprecated Modal: modal-header, modal-footer, Question: hasInput, invalid question types (invalid type attribute), Icons: {{ }} syntax.

modal-header and modal-footer in Modal, hasInput and invalid question types (invalid type attribute) in Question, {{ }} syntax in icons have been fully deprecated

To migrate:
Modal:

  • modal-header -> header
    • modal-header attribute has been fully deprecated
    • To migrate, replace the modal-header attribute with just header with the text in the attribute unchanged
    • e.g. <modal modal-header="HEADER TEXT"> to <modal header="HEADER TEXT">
  • modal-footer -> footer
    • modal-footer attribute has been fully deprecated
    • To migrate, replace the modal-footer attribute with just footer with the text in the attribute unchanged
    • e.g. <modal modal-footer="FOOTER TEXT"> to <modal footer="FOOTER TEXT">

Question:

  • has-input -> type="text"
    • has-input attribute has been fully deprecated
    • To migrate, replace the has-input attribute with type="text"
    • e.g. <question has-input> to <question type="text">
  • Invalid question types (invalid type attribute) now not supported
    • To migrate, give the question a valid type: mcq, checkbox, blanks, text

Icons:

  • {{ }} -> : :
    • To migrate, replace all {{ and }} to :
    • e.g. {{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: ☑️

  • Updated the documentation for feature additions and enhancements
  • Added tests for bug fixes or features
  • Linked all related issues
  • No unrelated changes

Copy link
Contributor

@jovyntls jovyntls left a comment

Choose a reason for hiding this comment

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

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

'modal-header': 'header',
'modal-footer': 'footer',
});
_warnDeprecatedSlotNames(node, {});
Copy link
Contributor

Choose a reason for hiding this comment

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

We can remove this method entirely since we'll no longer have deprecated slot names 🎉

@itsyme itsyme requested a review from jovyntls March 21, 2023 09:56
Copy link
Contributor

@jovyntls jovyntls left a comment

Choose a reason for hiding this comment

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

Thanks for the deprecation work @itsyme :)

I notice there's a <question> without any type in the test_site - can we add a question type to make sure we have no unexpected/undefined behaviour in our tests?

Comment on lines 223 to 224
isNotTextWithoutKeywords() {
return !(this.isTextQuestion() && !this.keywords);
Copy link
Contributor

Choose a reason for hiding this comment

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

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?

});
},
};
export const warnDeprecatedAtributesMap: { [attr: string]: (nd: MbNode) => void } = {};
Copy link
Contributor

Choose a reason for hiding this comment

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

Same for this - let's remove it entirely

Comment on lines 32 to 33
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function _warnDeprecatedSlotNames(element: MbNode, namePairs: { [name: string]: string }) {
Copy link
Contributor

Choose a reason for hiding this comment

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

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 = `
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be removed as well - it's the expected output of the removed test case

Copy link
Contributor

@jovyntls jovyntls left a comment

Choose a reason for hiding this comment

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

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-header is (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 :)

@itsyme
Copy link
Contributor Author

itsyme commented Mar 23, 2023

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-header is (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!

@jovyntls jovyntls added this to the v4.1.1 milestone Mar 23, 2023
Copy link
Contributor

@jovyntls jovyntls left a comment

Choose a reason for hiding this comment

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

LGTM! It's great that we're deprecating these, thanks @itsyme 😀

@jovyntls jovyntls added the breakingChange 💥 Feature will behave significantly different, or is made obsolete label Mar 23, 2023
@jovyntls jovyntls removed this from the v4.1.1 milestone Mar 23, 2023
@jovyntls jovyntls added this to the v5.0.0 milestone Mar 23, 2023
@jovyntls
Copy link
Contributor

@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)

@itsyme itsyme merged commit a422eb5 into MarkBind:master Mar 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breakingChange 💥 Feature will behave significantly different, or is made obsolete

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deprecation of slots, attributes and syntax

2 participants