1
0
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:
Jinxuan Zhu
2018-07-27 18:01:35 -04:00
committed by Ian Storm Taylor
parent 8deecc4461
commit c64c2ff025
2 changed files with 12 additions and 1 deletions

View File

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