tbonelee opened a new pull request, #5065: URL: https://github.com/apache/zeppelin/pull/5065
### What is this PR for? Circular imports in JS/TS can make imported symbols unexpectedly `undefined` at runtime and also confuse build and tooling. This PR introduces a TSLint rule to detect circular imports and refactors imports to prevent them. - Added `tslint-no-circular-imports` and enabled the rule. - Fixed explicit circular-import violations. - Standardized import conventions and layering rules to avoid regressions. #### Import conventions To keep dependencies simple and acyclic: 1. Cross-module improts -> use the modules's barrel Import from the module entry (its public API), not deep files. ```ts // good import { Foo } from '@zeppelin/some-module'; // bad import { Foo } from '@zeppelin/some-module/feature/foo'; ``` - Rationale: reduces tight coupling and ad-hoc interweaving between modules. 2. Intra-module imports -> use relative paths Inside the same module, import relatively instead of via that module's barrel. ```ts // good import { Bar } from './bar/bar.component'; // bad import { Bar } from '@zeppelin/this-module'; ``` - Rationale: prevents barrel -> implementation -> barrel loops that often create cycles. > Terminology > A "module" here means a directory published via a single alias like @zeppelin/{module} (one slash). #### Layering rules Enforce a single direction of dependencies. This keeps cycles out by construction. This interpretation aims to minimize disruption to the existing structure. If you have alternative proposals, please let me know. - `core`: framework-agnostic types, tokens, and utilities. - Can be used by anyone. - Must not depend on `services`, `pages`, or `share` - `services`: non-UI logics - May depend on `core`. - Must not depend on `share` or `pages`. - `pages`: May depend on `services`, `share`, and `core`. - `share` : presentational componets, directives - May depend on `core` and `service` ### What type of PR is it? Refactoring ### What is the Jira issue? [ZEPPELIN-6315](https://issues.apache.org/jira/browse/ZEPPELIN-6315) ### Questions: * Does the license files need to update? No * Is there breaking changes for older versions? No * Does this needs documentation? No -- 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: reviews-unsubscr...@zeppelin.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org