in src/rules/no-deprecated-colors.js [111:134]
CallExpression(node) {
// Skip if not calling the `themeGet` or `get` function
// `get` is the internal version of `themeGet` that's used in the primer/react repository
if (
!isThemeGet(node.callee, context.getScope(node), skipImportCheck) &&
!isGet(node.callee, context.getScope(node))
) {
return
}
const argument = node.arguments[0]
// Skip if the argument is not a Literal (themeGet(props.backgroundColor))
// or a string themeGet(2)
if (argument.type !== 'Literal' || typeof argument.value !== 'string') {
return
}
const [key, ...path] = argument.value.split('.')
const name = path.join('.')
if (['colors', 'shadows'].includes(key) && Object.keys(deprecations).includes(name)) {
replaceDeprecatedColor(context, argument, name, str => [key, str].join('.'))
}
}