aminghadersohi commented on code in PR #44927:
URL: https://github.com/apache/superset/pull/44927#discussion_r4174751522
##########
superset-frontend/scripts/check-custom-rules.js:
##########
@@ -174,6 +174,44 @@ function checkNoFaIcons(ast, filepath) {
});
}
+/**
+ * App code (and plugins) must go through the @superset-ui/core/components
+ * wrappers rather than importing from antd directly, so theming and behavior
+ * stay centralized in one place. The wrapper packages themselves
+ * (superset-ui-core, superset-core) are the legitimate exception -- they're
+ * what the wrappers are built from -- and `theme/utils` files that introspect
+ * antd's own design tokens are exempted the same way checkNoLiteralColors
+ * already exempts that directory (there is no wrapper for "list antd's own
+ * token names").
+ */
+const ANTD_DIRECT_IMPORT_EXEMPT = [
+ /\/theme\/utils\//,
+ /packages\/superset-ui-core\//,
+ /packages\/superset-core\//,
+];
+
+function checkNoDirectAntdImports(ast, filepath) {
+ if (ANTD_DIRECT_IMPORT_EXEMPT.some(pattern => pattern.test(filepath))) {
+ return;
+ }
+
+ traverse(ast, {
+ 'ImportDeclaration|ExportNamedDeclaration|ExportAllDeclaration'(path) {
Review Comment:
Longform works too: oxlint and oxfmt pass and all three re-export forms are
still flagged.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]