Yicong-Huang opened a new pull request, #5185:
URL: https://github.com/apache/texera/pull/5185

   ### What changes were proposed in this PR?
   
   Add an `*.spec.ts` override to `frontend/.eslintrc.json` that prevents the 
anti-pattern just swept in #5183 from creeping back:
   
   - `no-restricted-imports` blocks `HttpClientModule` from 
`@angular/common/http` in specs. `HttpClientTestingModule` is the only 
legitimate way to wire HttpClient into a unit test.
   - `no-restricted-syntax` flags `HttpClient` listed as a bare provider inside 
a `providers: [...]` array. `HttpClientTestingModule` (in `imports`) already 
supplies HttpClient; layering the real one on top overrides the testing backend.
   
   The rule surfaces five more specs that the original audit missed — each had 
either a redundant `HttpClientModule` import or a stale `HttpClient` provider 
sitting next to a working `HttpClientTestingModule`. Cleanups so `yarn lint` 
stays green:
   
   - `user-avatar.component.spec.ts` — drop the redundant `HttpClientModule` 
from `imports`.
   - `user-workflow.component.spec.ts`, `coeditor-user-icon.component.spec.ts`, 
`coeditor-presence.service.spec.ts` — drop the bare `HttpClient` provider and 
the now-unused import.
   - `operator-metadata.service.spec.ts` — drop the bare `HttpClient` provider. 
The import stays because the spec calls `TestBed.inject(HttpClient)` to talk to 
`HttpTestingController`.
   
   ### Any related issues, documentation, discussions?
   
   Closes #5184. Stacked on #5183 — both targets the same anti-pattern (#5183 
is the data cleanup, this PR is the lint guardrail). Please merge #5183 first; 
this branch will then rebase cleanly onto `main`.
   
   ### How was this PR tested?
   
   `yarn lint` exits 0 and `yarn format:ci` is clean. `yarn ng test 
--watch=false --include=…` against the nine touched specs runs 9 files / 37 
tests, all green.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Opus 4.7


-- 
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]

Reply via email to