@@ -43,9 +43,63 @@ Then configure the rules you want to use under the rules section.
43
43
44
44
## Supported Rules
45
45
46
- * Fill in provided rules here
47
-
48
-
49
-
46
+ #### uilib/no-hard-coded-color
47
+ ``` js
48
+ // Your app valid colors
49
+ const validColors = {
50
+ blue: ' #459FED' ,
51
+ red: ' #F2564D' ,
52
+ green: ' #00CD8B' ,
53
+ yellow: ' #FFB600' ,
54
+ }
50
55
56
+ // Lint will catch all hard coded color values in the code and replace with valid colors if exist
57
+ // `#459FED` will turn to `Colors.blue`
58
+ {
59
+ " rules" : {
60
+ " uilib/no-hard-coded-color" : [' error' , {validColors}]
61
+ }
62
+ }
63
+ ```
51
64
65
+ ### uilib/component-deprecation_warn, uilib/component-deprecation_error
66
+ ``` js
67
+
68
+ // deprecation message to warn you consumers about
69
+ const deprecationWarnings = [
70
+ {
71
+ " component" : " ActivityIndicator" ,
72
+ " source" : " react-native" ,
73
+ " message" : " Please avoid using react-native ActivityIndicator, use the 'Loader' component instead"
74
+ },
75
+ {
76
+ " component" : " OldComponent" ,
77
+ " source" : " react-native-ui-lib" ,
78
+ " message" : " Please use the 'NewComponent' instead. Auto fix available." ,
79
+ " fix" : { " componentName" : " NewComponent" }
80
+ },
81
+ ];
82
+
83
+ const deprecationErrors = [
84
+ {
85
+ " component" : " Button" , // / The component
86
+ " source" : " react-native-ui-lib" , // The source you import the component from
87
+ " message" : " " ,
88
+ " props" : [
89
+ {
90
+ " prop" : " title" , // the prop to depreciate
91
+ " message" : " Please use `label` prop instead of `title` prop" , // custom message to the user
92
+ " fix" : { " propName" : " label" } // provice auto fix
93
+ }
94
+ ]
95
+ },
96
+ ];
97
+
98
+ // Two phases: warn & error to allow phasing your migration process
99
+ {
100
+ " rules" : {
101
+ ' uilib/component-deprecation_warn' : [' warn' , {deprecations: deprecationWarnings, dueDate: ' Thursday 31 January' }],
102
+ ' uilib/component-deprecation_error' : [' error' , {deprecations: deprecationErrors , dueDate: ' Thursday 31 January'
103
+ }
104
+ }
105
+ ` ` `
0 commit comments