Skip to content

Commit 8d91684

Browse files
Add component has moved console warning
1 parent 41331ae commit 8d91684

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */
2+
/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */
3+
4+
/* eslint-disable import/no-mutable-exports */
5+
6+
import warning from 'warning';
7+
8+
let hasMoved = function () {};
9+
10+
if (process.env.NODE_ENV !== 'production') {
11+
const hasWarned = {};
12+
13+
hasMoved = function (control, { oldFileLocation, newFileLocation, comment }) {
14+
const additionalComment = comment ? ` ${comment}` : '';
15+
if (!hasWarned[control]) {
16+
/* eslint-disable max-len */
17+
warning(
18+
false,
19+
`[Design System React] ${control} file import path has changed. Old import path was \`design-system-react/${oldFileLocation}\`. New import path is \`design-system-react/${newFileLocation}\`.${additionalComment}`
20+
);
21+
/* eslint-enable max-len */
22+
hasWarned[control] = true;
23+
}
24+
};
25+
}
26+
27+
export default hasMoved;

0 commit comments

Comments
 (0)