Aman-Mittal opened a new issue, #683:
URL: https://github.com/apache/fineract-backoffice-ui/issues/683

   `no-restricted-imports` is down to **64 violations across 60 files**, and 
the composition is now lopsided:
   
   | imported | files |
   | --- | --- |
   | `@ngx-translate/core` | 53 |
   | `@ionic/angular/standalone` (imperative controllers only) | 11 |
   
   The ngx-translate half is the tail of the batch migration that took this 
rule from 235 to 64. It is mechanical, well-trodden, and splits cleanly into 
several small PRs — which is how the earlier batches went in, a few feature 
areas at a time.
   
   ## What the change is
   
   ```ts
   // before
   import { TranslatePipe } from '@ngx-translate/core';
   imports: [TranslatePipe],
   // {{ 'LOANS.APPROVE' | translate }}
   
   // after
   import { TranslatePipe } from '../../core/adapters';
   imports: [TranslatePipe],
   // {{ 'LOANS.APPROVE' | appTranslate }}
   ```
   
   **The pipe name changes too.** The adapter pipe is `@Pipe({ name: 
'appTranslate' })` — swapping the import without swapping `| translate` to `| 
appTranslate` in the template leaves the template referring to a pipe that is 
no longer imported. In TypeScript, `translate.instant(key)` becomes 
`i18n.translate(key)` on the injected `I18N` token.
   
   ## Two things that cost time last round
   
   - **`import/no-duplicates`.** A file that already imports something from 
`core/adapters` ends up with two import statements from the same specifier, 
which is its own lint error. Merge them — but never merge an `import type` with 
a value import.
   - **One import statement is one violation, not one per symbol.** The rule 
reports per statement, so a file importing three things from 
`@ngx-translate/core` still counts once. Useful when estimating a batch.
   
   ## Worth knowing
   
   `translate()` returns the key itself when there is no translation, never an 
empty string — a blank label in a banking UI is indistinguishable from a field 
with no value, whereas a visible `LOANS.APPROVE` diagnoses itself. 
`appTranslate` is `pure: false` so a language switch re-renders without a 
subscription.
   
   `app-data-table` still uses the vendor `| translate` internally, so specs 
that render it need `provideTranslateTesting()` configured even after the 
component under test has moved.
   
   ## Scope
   
   Please take a few feature areas per PR rather than all 53 at once — the 
earlier batches were reviewable precisely because they were small. The 
remaining 11 Ionic-controller imports are a separate boundary (ADR 0003's 
imperative surface, reached through `OVERLAY`) and should not be mixed in; 
`eslint-suppressions.json` counts them on the same rule id, so a PR that trades 
one for the other leaves the ratchet unmoved.
   
   ## Acceptance
   
   - `no-restricted-imports` falls by the number of files the PR touches, 
verified with `npm run lint:prune`.
   - No template is left referring to `| translate` without importing the 
vendor pipe.
   - `npm run lint`, `npm run i18n:check` and the suite all pass.
   
   Background: `DOCS/adr/0003-adapter-boundary.md`, 
`DOCS/ADAPTERS.md#translation`.
   


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