-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Deprecated: Introduce new module with depreaction util #6914
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,10 +29,6 @@ import { | |
toAsyncIterable, | ||
} from '../'; | ||
|
||
jest.mock( '@wordpress/utils', () => ( { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be neat to have something like our ESLint There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it would help to remove it together with the code that was deprecated. Another option would be to include |
||
deprecated: jest.fn(), | ||
} ) ); | ||
|
||
// Mock data store to prevent self-initialization, as it needs to be reset | ||
// between tests of `registerResolvers` by replacement (new `registerStore`). | ||
jest.mock( '../store', () => () => {} ); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package-lock=false |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# @wordpress/deprecated | ||
|
||
Logs a message to notify developers about a deprecated feature. | ||
|
||
## Installation | ||
|
||
Install the module | ||
|
||
```bash | ||
npm install @wordpress/deprecated@next --save | ||
``` | ||
|
||
## Usage | ||
|
||
```js | ||
import deprecated from '@wordpress/deprecated'; | ||
|
||
deprecated( 'Eating meat', { | ||
version: 'the future', | ||
alternative: 'vegetables', | ||
plugin: 'the earth', | ||
hint: 'You may find it beneficial to transition gradually.', | ||
} ); | ||
|
||
// Logs: 'Eating meat is deprecated and will be removed from the earth in the future. Please use vegetables instead. Note: You may find it beneficial to transition gradually.' | ||
``` | ||
|
||
<br/><br/><p align="center"><img src="https://s.w.org/style/images/codeispoetry.png?1" alt="Code is Poetry." /></p> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "@wordpress/deprecated", | ||
"version": "0.0.1", | ||
"description": "Deprecation utility for WordPress", | ||
"author": "WordPress", | ||
"license": "GPL-2.0-or-later", | ||
"keywords": [ | ||
"wordpress", | ||
"deprecated" | ||
], | ||
"homepage": "https://github.com/WordPress/gutenberg/tree/master/packages/deprecated/README.md", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/WordPress/gutenberg.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/WordPress/gutenberg/issues" | ||
}, | ||
"main": "src/index.js", | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,6 @@ export { decodeEntities }; | |
export { keycodes }; | ||
|
||
export * from './blob-cache'; | ||
export * from './deprecation'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Love the effort to rid the world of |
||
export * from './mediaupload'; | ||
export * from './terms'; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: This pattern should be
/^deprecated$/
(otherwise matching e.g.deprecatedfoo
)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed it too late, it is included together with changes planned for
data
package. Sorry about that :)