mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-18 21:21:21 +02:00
Ensure no deprecate exists in slate-core development (#1991)
* Throw error in test mode * Ensure process * Allow deprecate with user config * Style fix * fix grammer typo
This commit is contained in:
committed by
Ian Storm Taylor
parent
8deecc4461
commit
c64c2ff025
@@ -1,5 +1,12 @@
|
||||
/* eslint-disable no-console */
|
||||
|
||||
/**
|
||||
* Is deprecate interface forbidden?
|
||||
*/
|
||||
|
||||
const FORBID_DEPRECATE =
|
||||
process && process.env && process.env.FORBID_DEPRECATIONS
|
||||
|
||||
/**
|
||||
* Is in development?
|
||||
*
|
||||
@@ -75,6 +82,10 @@ function warn(message, ...args) {
|
||||
*/
|
||||
|
||||
function deprecate(version, message, ...args) {
|
||||
if (FORBID_DEPRECATE) {
|
||||
throw new Error(`Deprecation (${version}): ${message}`)
|
||||
}
|
||||
|
||||
log('warn', `Deprecation (${version}): ${message}`, ...args)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user