Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #171 from eemeli/drop-depreactions
Drop deprecated end points, members, options & defaults
- Loading branch information
Showing
36 changed files
with
56 additions
and
271 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,20 @@ | ||
/* global console, process, YAML_SILENCE_DEPRECATION_WARNINGS, YAML_SILENCE_WARNINGS */ | ||
/* global console, process, YAML_SILENCE_WARNINGS */ | ||
|
||
function shouldWarn(deprecation) { | ||
const env = (typeof process !== 'undefined' && process.env) || {} | ||
export function warn(warning, type) { | ||
if (typeof YAML_SILENCE_WARNINGS !== 'undefined' && YAML_SILENCE_WARNINGS) | ||
return | ||
|
||
if (deprecation) { | ||
if (typeof YAML_SILENCE_DEPRECATION_WARNINGS !== 'undefined') | ||
return !YAML_SILENCE_DEPRECATION_WARNINGS | ||
return !env.YAML_SILENCE_DEPRECATION_WARNINGS | ||
} | ||
if (typeof process !== 'undefined') { | ||
if (process.env.YAML_SILENCE_WARNINGS) return | ||
|
||
if (typeof YAML_SILENCE_WARNINGS !== 'undefined') | ||
return !YAML_SILENCE_WARNINGS | ||
return !env.YAML_SILENCE_WARNINGS | ||
} | ||
|
||
export function warn(warning, type) { | ||
if (shouldWarn(false)) { | ||
const emit = typeof process !== 'undefined' && process.emitWarning | ||
// This will throw in Jest if `warning` is an Error instance due to | ||
// https://github.com/facebook/jest/issues/2549 | ||
if (emit) emit(warning, type) | ||
else { | ||
// eslint-disable-next-line no-console | ||
console.warn(type ? `${type}: ${warning}` : warning) | ||
if (process.emitWarning) { | ||
process.emitWarning(warning, type) | ||
return | ||
} | ||
} | ||
} | ||
|
||
export function warnFileDeprecation(filename) { | ||
if (shouldWarn(true)) { | ||
const path = filename | ||
.replace(/.*yaml[/\\]/i, '') | ||
.replace(/\.js$/, '') | ||
.replace(/\\/g, '/') | ||
warn( | ||
`The endpoint 'yaml/${path}' will be removed in a future release.`, | ||
'DeprecationWarning' | ||
) | ||
} | ||
} | ||
|
||
const warned = {} | ||
export function warnOptionDeprecation(name, alternative) { | ||
if (!warned[name] && shouldWarn(true)) { | ||
warned[name] = true | ||
let msg = `The option '${name}' will be removed in a future release` | ||
msg += alternative ? `, use '${alternative}' instead.` : '.' | ||
warn(msg, 'DeprecationWarning') | ||
} | ||
// eslint-disable-next-line no-console | ||
console.warn(type ? `${type}: ${warning}` : warning) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.