Skip to content

Commit

Permalink
Catch colors when theme top level (#19571)
Browse files Browse the repository at this point in the history
  • Loading branch information
geido committed Apr 8, 2022
1 parent 761d5c4 commit 16f193c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions superset-frontend/tools/eslint-plugin-theme-colors/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,19 @@ module.exports = {
return {
TemplateElement(node) {
const rawValue = node?.value?.raw;
const isParentProperty =
const isChildParentTagged =
node?.parent?.parent?.type === 'TaggedTemplateExpression';
const isChildParentArrow =
node?.parent?.parent?.type === 'ArrowFunctionExpression';
const isParentTemplateLiteral =
node?.parent?.type === 'TemplateLiteral';
const loc = node?.parent?.parent?.loc;
const locId = loc && JSON.stringify(loc);
const hasWarned = warned.includes(locId);
if (
!hasWarned &&
isParentProperty &&
(isChildParentTagged ||
(isChildParentArrow && isParentTemplateLiteral)) &&
rawValue &&
(hasLiteralColor(rawValue) ||
hasHexColor(rawValue) ||
Expand Down

0 comments on commit 16f193c

Please sign in to comment.