[wp-trac] [WordPress Trac] #51200: Consider a better way to deprecate JavaScript code

WordPress Trac noreply at wordpress.org
Mon Aug 31 20:56:32 UTC 2020


#51200: Consider a better way to deprecate JavaScript code
----------------------------------------+-----------------------------
 Reporter:  SergeyBiryukov              |      Owner:  (none)
     Type:  enhancement                 |     Status:  new
 Priority:  normal                      |  Milestone:  Awaiting Review
Component:  Script Loader               |    Version:
 Severity:  normal                      |   Keywords:
  Focuses:  javascript, administration  |
----------------------------------------+-----------------------------
 Background: #51123

 At the moment, we have some established functions for deprecating PHP
 functionality:
 * `_deprecated_function()`
 * `_deprecated_constructor()`
 * `_deprecated_file()`
 * `_deprecated_argument()`
 * `_deprecated_hook()`
 As well as some files to move deprecated functions to:
 * `wp-admin/includes/deprecated.php`
 * `wp-admin/includes/ms-deprecated.php`
 * `wp-includes/deprecated.php`
 * `wp-includes/ms-deprecated.php`
 * `wp-includes/pluggable-deprecated.php`

 We don't, however, have a similar way to deprecate JavaScript
 functionality, sometimes leading to more breakage than necessary when
 removing global objects or properties without backward compatibility
 considerations.

 [48923] attempted to improve things a bit introducing
 `deprecatedProperty()`.

 Some ideas previously suggested to further make sure we have a way to
 deprecate JavaScript code properly:
 * Have a clear deprecation policy of when the affected code should be
 removed.
 * Use the [https://developer.wordpress.org/block-editor/packages/packages-
 deprecated/ @wordpress/deprecated] package (suggested by @ocean90 in
 comment:33:ticket:51123).
 * Create a `deprecated.js` file for the code to be moved to (suggested by
 @desrosj on Slack).

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/51200>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list