You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by di...@apache.org on 2022/04/08 12:20:32 UTC

[superset] branch master updated: Catch colors when theme top level (#19571)

This is an automated email from the ASF dual-hosted git repository.

diegopucci pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 16f193c813 Catch colors  when theme top level (#19571)
16f193c813 is described below

commit 16f193c813933aff89dada664b2485cbc3d99723
Author: Geido <60...@users.noreply.github.com>
AuthorDate: Fri Apr 8 15:20:23 2022 +0300

    Catch colors  when theme top level (#19571)
---
 superset-frontend/tools/eslint-plugin-theme-colors/index.js | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/superset-frontend/tools/eslint-plugin-theme-colors/index.js b/superset-frontend/tools/eslint-plugin-theme-colors/index.js
index ce0d492a1c..ed1bd4d392 100644
--- a/superset-frontend/tools/eslint-plugin-theme-colors/index.js
+++ b/superset-frontend/tools/eslint-plugin-theme-colors/index.js
@@ -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) ||