@@ -25,6 +25,11 @@ module.exports = {
25
25
const skipImportCheck = context . options [ 0 ] ? context . options [ 0 ] . skipImportCheck : false
26
26
27
27
return {
28
+ Literal ( node ) {
29
+ if ( Object . keys ( deprecations ) . includes ( node . value ) ) {
30
+ replaceDeprecatedColor ( context , node , node . value )
31
+ }
32
+ } ,
28
33
JSXOpeningElement ( node ) {
29
34
// Skip if component was not imported from @primer /components
30
35
if ( ! skipImportCheck && ! isPrimerComponent ( node . name , context . getScope ( node ) ) ) {
@@ -43,15 +48,15 @@ module.exports = {
43
48
if ( propName === 'sx' && attribute . value . expression . type === 'ObjectExpression' ) {
44
49
// Search all properties of the sx object (even nested properties)
45
50
traverse ( context , attribute . value , path => {
46
- if ( path . node . type === 'Property' && path . node . value . type === 'Literal' ) {
47
- const prop = path . node
48
- const propName = prop . key . name
49
- const propValue = prop . value . value
50
-
51
- if ( styledSystemColorProps . includes ( propName ) && Object . keys ( deprecations ) . includes ( propValue ) ) {
52
- replaceDeprecatedColor ( context , prop . value , propValue )
53
- }
54
- }
51
+ // if (path.node.type === 'Property' && path.node.value.type === 'Literal') {
52
+ // const prop = path.node
53
+ // const propName = prop.key.name
54
+ // const propValue = prop.value.value
55
+
56
+ // if (styledSystemColorProps.includes(propName) && Object.keys(deprecations).includes(propValue)) {
57
+ // replaceDeprecatedColor(context, prop.value, propValue)
58
+ // }
59
+ // }
55
60
56
61
// Check functions passed to sx object properties
57
62
// (e.g. boxShadow: theme => `0 1px 2px ${theme.colors.text.primary}` )
@@ -84,9 +89,9 @@ module.exports = {
84
89
}
85
90
86
91
// Check if styled-system color prop is using a deprecated color
87
- if ( styledSystemColorProps . includes ( propName ) && Object . keys ( deprecations ) . includes ( propValue ) ) {
88
- replaceDeprecatedColor ( context , attribute . value , propValue )
89
- }
92
+ // if (styledSystemColorProps.includes(propName) && Object.keys(deprecations).includes(propValue)) {
93
+ // replaceDeprecatedColor(context, attribute.value, propValue)
94
+ // }
90
95
}
91
96
} ,
92
97
CallExpression ( node ) {
0 commit comments