romanrostislavovich / ngx-translate-lint

Simple CLI tools for check `ngx-translate` keys
MIT License
33 stars 9 forks source link

Keys used in pipes or other .ts files only are reported as missing #147

Open grackeon opened 2 years ago

grackeon commented 2 years ago

Bug report

Describe the bug

If a translation key is only used in pipes or .ts classes of the component (so complex logic is not included in the view directly), the linting treats the key as missing.

ngx-translate-lint@1.11.0 works fine. ngx-translate-lint@1.20.4 shows error that keys don't exist in project.

To Reproduce

Steps to reproduce the behavior:

@Injectable() export class SomePipe implements PipeTransform { constructor(private translateService: TranslateService) { }

transform(value): string { return this.translateService.instant('key1'); } }


- Add `key1` to the translation file.
- Execute `ngx-translate-lint`
- Linting fails with error: `Key: 'key1' doesn't exist in project'`

## Expected behavior

Linting should not treat keys as not-existing if they are used in pipes or other methods of `*.component.ts` files.
romanrostislavovich commented 2 years ago

Hi @Moritz1409

It's the same as previous bag (#146)

I think the main problem is on flag --deepSearch. In previous versions, logic (from ---deepSearch) was included in the main flow. But I created a separate flag, because that logic works slowly (on big projects). Right now this flag is disable by default.

Could you pls enable this flag and check result?

grackeon commented 2 years ago

This also works as before with --deepSearch being enabled. Thanks again!

romanrostislavovich commented 2 years ago

Hi @Moritz1409 thanks for quick answer, :) I try to resolve your issue without this flag in the future.

Have a nice day

julianpoy commented 1 year ago

@svoboda-rabstvo --deepSearch enabled takes far longer to run compared to the older versions before this flag existed. I see a 3x increase in time in comparison to version 1.14.1.

Unfortunately without the --deepSearch flag enabled, I get the same issue as the original issue poster.

romanrostislavovich commented 11 months ago

@julianpoy Yes, you're absolutely right. I'm working on it right now :) When I have update I will write here