-
Notifications
You must be signed in to change notification settings - Fork 429
/
Copy pathcheck-props.js
58 lines (52 loc) · 1.47 KB
/
check-props.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */
/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */
/* eslint-disable import/no-mutable-exports */
import sunsetProperty from '../../utilities/warning/sunset-property';
import getComponentDocFn from '../../utilities/get-component-doc';
let checkProps = function checkPropsFunction() {};
if (process.env.NODE_ENV !== 'production') {
checkProps = function checkPropsFunction(COMPONENT, props, jsonDoc) {
const createDocUrl = getComponentDocFn(jsonDoc);
/* eslint-disable max-len */
sunsetProperty(
COMPONENT,
props.iconCategory,
'iconCategory',
`Use \`Icon\` instead. ${createDocUrl('icon')}`
);
sunsetProperty(
COMPONENT,
props.iconName,
'iconName',
`Use \`Icon\` instead. ${createDocUrl('icon')}`
);
sunsetProperty(
COMPONENT,
props.content,
'content',
`Use \`labels.heading\` and \`labels.headingLink\` instead. ${createDocUrl(
'labels'
)}`
);
sunsetProperty(
COMPONENT,
props.isOpen,
'isOpen',
`Use a conditional outside of alert. ${createDocUrl()}`
);
sunsetProperty(
COMPONENT,
props.isOpen,
'onDismiss',
`Use \`onRequestClose\` instead. ${createDocUrl('onRequestClose')}`
);
sunsetProperty(COMPONENT, props.texture, 'texture', createDocUrl());
sunsetProperty(
COMPONENT,
props.theme,
'theme',
`Use \`variant\` instead. ${createDocUrl('variant')}`
);
};
}
export default checkProps;