Aman-Mittal opened a new pull request, #668:
URL: https://github.com/apache/fineract-backoffice-ui/pull/668
Moves the ESLint ratchet down by 171, from **953 to 782**.
`no-restricted-imports` goes from 235 to 64 — a 73% reduction on that rule.
## Why this rule, and why now
`npm run lint:prune` was the first thing run, to find out how much of the
baseline was stale rather than real. It removed **nothing**: all 953 entries
correspond to live violations, so the number only comes down by migrating code.
Of the 235 on `no-restricted-imports`, 224 are the ADR 0003 i18n boundary
and 11 are Ionic controllers. Of those 224, **176 files import nothing from the
library but `TranslatePipe`** — and that case is the migration
`translate.pipe.ts` describes in its own docblock:
> Migrating a component is a one-line import swap plus a rename at each call
site.
So this is that, 171 times, by script. Nothing else changes: no template
text, no translation key, no behaviour.
## The two edits
```diff
-import { TranslatePipe } from '@ngx-translate/core';
+import { TranslatePipe } from '../../../core/adapters';
-<ion-card-title>{{ 'TELLERS.ALLOCATE_CASHIER' | translate
}}</ion-card-title>
+<ion-card-title>{{ 'TELLERS.ALLOCATE_CASHIER' | appTranslate
}}</ion-card-title>
```
The call-site rename matches `| translate` only when not followed by a word
character, so `| translate: { count: n }` migrates and nothing that merely
starts with those letters is touched.
29 files already imported something else from the adapters barrel and ended
up with two imports of it. `import/no-duplicates` is not on the ratchet, so
that would have failed the build rather than being absorbed — a second pass
merges each pair into one statement. Value and `import type` statements are
never merged with each other.
Split into two commits — nine feature areas, then the rest — so the
mechanical shape is easy to confirm on a smaller diff before reading the large
one.
## What is deliberately left behind
| | |
|---|---|
| 34 files that also import `TranslateService` | They need the `I18N`
adapter, which is a judgement call per call site rather than a rename |
| 11 Ionic controller imports | Same rule id, different boundary — those are
`OVERLAY` |
| 5 files under `shared/components` | A shared component moving to the
adapter changes what every spec rendering it has to provide. `i18n-testing.ts`
documents that coupling directly, and unpicking it deserves its own change with
its own test run |
## Verification
```
npm run test:unit 279 files / 1827 tests passed
npm run lint:prune 953 -> 782 suppressions
npm run i18n:check clean
npm run check:template-text clean
npm run check:a11y-names clean
npm run check:ui-primitives clean
npm run check:responsive clean
npm run format:check clean
```
The translation checker already understood both pipe spellings before this
change — `check-translations.mjs` matches `'KEY' | translate` and `'KEY' |
appTranslate` alike — so key coverage is measured the same way on both sides of
the migration.
One note for whoever takes the next batch: `eslint-suppressions.json` is
ESLint's **default** suppressions location, so a bare `npx eslint <file>`
silently applies it and reports a clean file. Pass `--suppressions-location`
pointed at a file holding `{}` to see what is actually suppressed.
--
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]