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

Convert shortcode package to TypeScript #60526

Conversation

mikeybinns
Copy link
Contributor

What?

Converting the shortcodes package to TypeScript.

Why?

It's an enhancement, while not necessary it is helpful to reduce bugs in both the code of the package and end users code if they consume types.

How?

  • All JS files converted to TypeScript
  • Changed object.assign to JS Class declaration for clarity.
  • Removed attrs method from shortcode class as it was inaccessible due to a property of the same name. attrs function is still exported separately as before.
  • Types exported from package.json
  • I fixed a bug in the implementation of the shortcode class where valid attribute objects were treated as shallow objects.
  • Add a few extra automated tests to cover that bug

Testing Instructions

Covered by automatic tests.

Testing Instructions for Keyboard

N/A

Screenshots or screencast

N/A

Copy link

github-actions bot commented Apr 6, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: mirka <[email protected]>
Co-authored-by: ellatrix <[email protected]>
Co-authored-by: draganescu <[email protected]>
Co-authored-by: tyxla <[email protected]>
Co-authored-by: jsnajdr <[email protected]>
Co-authored-by: oandregal <[email protected]>
Co-authored-by: ntsekouras <[email protected]>
Co-authored-by: shail-mehta <[email protected]>
Co-authored-by: t-hamano <[email protected]>
Co-authored-by: tellthemachines <[email protected]>
Co-authored-by: talldan <[email protected]>
Co-authored-by: timse201 <[email protected]>
Co-authored-by: im3dabasia <[email protected]>
Co-authored-by: fushar <[email protected]>
Co-authored-by: justlevine <[email protected]>
Co-authored-by: rilwis <[email protected]>
Co-authored-by: Lovor01 <[email protected]>
Co-authored-by: ciampo <[email protected]>
Co-authored-by: d-alleyne <[email protected]>
Co-authored-by: juanfra <[email protected]>
Co-authored-by: Infinite-Null <[email protected]>
Co-authored-by: aaronrobertshaw <[email protected]>
Co-authored-by: ramonjd <[email protected]>
Co-authored-by: Sukhendu2002 <[email protected]>
Co-authored-by: stokesman <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: gziolo <[email protected]>
Co-authored-by: SH4LIN <[email protected]>
Co-authored-by: louwie17 <[email protected]>
Co-authored-by: gigitux <[email protected]>
Co-authored-by: youknowriad <[email protected]>
Co-authored-by: jorgefilipecosta <[email protected]>
Co-authored-by: yogeshbhutkar <[email protected]>
Co-authored-by: sirreal <[email protected]>
Co-authored-by: up1512001 <[email protected]>
Co-authored-by: himanshupathak95 <[email protected]>
Co-authored-by: manzoorwanijk <[email protected]>
Co-authored-by: shimotmk <[email protected]>
Co-authored-by: fabiankaegy <[email protected]>
Co-authored-by: dhruvikpatel18 <[email protected]>
Co-authored-by: mikeybinns <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@gziolo gziolo added [Type] Code Quality Issues or PRs that relate to code quality Developer Experience Ideas about improving block and theme developer experience labels Apr 6, 2024
@manzoorwanijk
Copy link
Member

We can close or redo this following #67416.

CC @gziolo

@mikeybinns
Copy link
Contributor Author

Happy to close mine :)

@mikeybinns mikeybinns closed this Nov 30, 2024
@gziolo
Copy link
Member

gziolo commented Nov 30, 2024

Nice! It’s exactly what needs to happen next. We definitely need to refresh this PR. @mikeybinns, will you have time to rebase this branch with trunk or is it fine to open another branch based on the existing code?

@gziolo
Copy link
Member

gziolo commented Nov 30, 2024

Ok, good. We definitely want to reuse all the new tests introduced in addition to other changes proposed ❤️

@mikeybinns
Copy link
Contributor Author

Okay, in that case, I will rebase it when I have time :)

@mikeybinns mikeybinns reopened this Nov 30, 2024
mirka and others added 19 commits December 20, 2024 23:24
* Inserter: Add 'Starter Content' category to the inserter

* Add cat condition

* Replace Starter Content modal with inserter panel

* remove option condition

* remove duplicated category

* Attempt to fix media panel test

* Attempt to fix style variations test

* Attempt to fix recursive pattern test

* Attempt to fix template resolution test

* Attempt to fix new page test

* Tweak template resolution test

* Remove categoryObject

* Fix aria-current on category tabs

* Fix selected cat in patterns explorer

* pass postId so that the inserter gets reopened when a new page is created using the command palette

* Take control of zoom if a new page is created

* Add post Id back

---------

Co-authored-by: Andrei Draganescu <[email protected]>
Co-authored-by: Sarah Norris <[email protected]>
Co-authored-by: Ben Dwyer <[email protected]>
* Navigation: Upsize buttons

* Add changelog

Co-authored-by: mirka <[email protected]>
Co-authored-by: ciampo <[email protected]>
Co-authored-by: tyxla <[email protected]>
…canvas is zoomed out (WordPress#68106)

* remove the placeholder text of and disable the default paragraph block, in zoom out mode

* leave the block enabled

* update the custom placeholder data attribute


Co-authored-by: draganescu <[email protected]>
Co-authored-by: talldan <[email protected]>
Co-authored-by: scruffian <[email protected]>
Co-authored-by: getdave <[email protected]>
Co-authored-by: richtabor <[email protected]>
Co-authored-by: colorful-tones <[email protected]>
Co-authored-by: ndiego <[email protected]>
Co-authored-by: andrewserong <[email protected]>
* Navigation: Log deprecation warning

* Add changelog

Co-authored-by: mirka <[email protected]>
Co-authored-by: ciampo <[email protected]>
Co-authored-by: tyxla <[email protected]>
…68176)

Co-authored-by: jsnajdr <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: tyxla <[email protected]>
Co-authored-by: mirka <[email protected]>
* Inserter: Use 40px default size for toggle button

* Add todo comments

Co-authored-by: mirka <[email protected]>
Co-authored-by: ciampo <[email protected]>
Co-authored-by: tyxla <[email protected]>
…8208)

* Components: Normalize newlines

* Clarify helper function

Co-authored-by: mirka <[email protected]>
Co-authored-by: tyxla <[email protected]>
* Updated documentation order

* Added Backport changelog

Co-authored-by: shail-mehta <[email protected]>
Co-authored-by: t-hamano <[email protected]>
Co-authored-by: t-hamano <[email protected]>
Co-authored-by: ryanwelcher <[email protected]>
* Try splitting style book into sections.

* Single block view

* Fix classic stylebook logic

* Blocks without examples should show all blocks

* Update scrolling logic to always scroll to top on long pages

* Scroll to top for color

---------

Co-authored-by: tellthemachines <[email protected]>
Co-authored-by: ramonjd <[email protected]>
Co-authored-by: kurudrive <[email protected]>
Co-authored-by: talldan <[email protected]>
Co-authored-by: luisherranz <[email protected]>
Co-authored-by: ramonjd <[email protected]>
* split upload

* split upload

* split upload

* split upload

* split upload

* Add missing imports for _x function

---------

Co-authored-by: timse201 <[email protected]>
Co-authored-by: talldan <[email protected]>
Co-authored-by: im3dabasia <[email protected]>
Co-authored-by: fabiankaegy <[email protected]>
…action (WordPress#68174)

* Stylebook: add the Appearance -> Design submenu through admin_menu action

* Add backport reference

Co-authored-by: fushar <[email protected]>
Co-authored-by: ramonjd <[email protected]>
@mikeybinns
Copy link
Contributor Author

@gziolo Sorry, this is the second time I've made this kind of mistake, do you know what I'm doing wrong here? I tried to rebase the branch and it's said I've changed all sorts of files I haven't, and subsequently notifying basically everyone who's ever commited to WordPress :(

I did a git rebase via VS Code:
image
and then just merged my changed into the re-based branch.

Sorry again everyone 😬

@manzoorwanijk
Copy link
Member

You should have done a trunk merge instead.

@mikeybinns mikeybinns restored the convert-shortcode-package-to-typescript branch January 23, 2025 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Developer Experience Ideas about improving block and theme developer experience [Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.