diff --git a/packages/grafana-ui/src/components/ColorPicker/warnAboutColorPickerPropsDeprecation.ts b/packages/grafana-ui/src/components/ColorPicker/warnAboutColorPickerPropsDeprecation.ts index b8919c682e2..fb4e454d2f9 100644 --- a/packages/grafana-ui/src/components/ColorPicker/warnAboutColorPickerPropsDeprecation.ts +++ b/packages/grafana-ui/src/components/ColorPicker/warnAboutColorPickerPropsDeprecation.ts @@ -1,9 +1,9 @@ -import propDeprecationWarning from '../../utils/propDeprecationWarning'; +import deprecationWarning from '../../utils/deprecationWarning'; import { ColorPickerProps } from './ColorPickerPopover'; export const warnAboutColorPickerPropsDeprecation = (componentName: string, props: ColorPickerProps) => { const { onColorChange } = props; if (onColorChange) { - propDeprecationWarning(componentName, 'onColorChange', 'onChange'); + deprecationWarning(componentName, 'onColorChange', 'onChange'); } }; diff --git a/packages/grafana-ui/src/utils/deprecationWarning.ts b/packages/grafana-ui/src/utils/deprecationWarning.ts new file mode 100644 index 00000000000..3182f232638 --- /dev/null +++ b/packages/grafana-ui/src/utils/deprecationWarning.ts @@ -0,0 +1,6 @@ +const deprecationWarning = (file: string, oldName: string, newName: string) => { + const message = `[Deprecation warning] ${file}: ${oldName} is deprecated. Use ${newName} instead`; + console.warn(message); +}; + +export default deprecationWarning; diff --git a/packages/grafana-ui/src/utils/index.ts b/packages/grafana-ui/src/utils/index.ts index d1c6deb096c..a2acc828752 100644 --- a/packages/grafana-ui/src/utils/index.ts +++ b/packages/grafana-ui/src/utils/index.ts @@ -3,4 +3,5 @@ export * from './valueFormats/valueFormats'; export * from './colors'; export * from './namedColorsPalette'; export * from './string'; +export * from './deprecationWarning'; export { getMappedValue } from './valueMappings'; diff --git a/packages/grafana-ui/src/utils/propDeprecationWarning.ts b/packages/grafana-ui/src/utils/propDeprecationWarning.ts deleted file mode 100644 index a277395c090..00000000000 --- a/packages/grafana-ui/src/utils/propDeprecationWarning.ts +++ /dev/null @@ -1,6 +0,0 @@ -const propDeprecationWarning = (componentName: string, propName: string, newPropName: string) => { - const message = `[Deprecation warning] ${componentName}: ${propName} is deprecated. Use ${newPropName} instead`; - console.warn(message); -}; - -export default propDeprecationWarning; diff --git a/public/app/core/utils/kbn.ts b/public/app/core/utils/kbn.ts index dd79d552277..d747fa37f57 100644 --- a/public/app/core/utils/kbn.ts +++ b/public/app/core/utils/kbn.ts @@ -1,5 +1,6 @@ import _ from 'lodash'; import { getValueFormat, getValueFormatterIndex, getValueFormats, stringToJsRegex } from '@grafana/ui'; +import deprecationWarning from '@grafana/ui/src/utils/deprecationWarning'; const kbn: any = {}; @@ -230,7 +231,7 @@ kbn.slugifyForUrl = str => { /** deprecated since 6.1, use grafana/ui */ kbn.stringToJsRegex = str => { - console.warn('Migrate stringToJsRegex to grafana/ui, '); + deprecationWarning('kbn.ts', 'kbn.stringToJsRegex()', '@grafana/ui'); return stringToJsRegex(str); };