Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive in pipe parameter #200

Closed
emilio-simoes opened this issue Dec 20, 2016 · 7 comments
Closed

False positive in pipe parameter #200

emilio-simoes opened this issue Dec 20, 2016 · 7 comments

Comments

@emilio-simoes
Copy link

emilio-simoes commented Dec 20, 2016

I'm getting a false positive when using angular2localization translate pipe. The pipe requires some parameters like:

<h1>{{ 'toolbar.title' | translate:lang }}</h1>

but the lang parameter is causing the following error:

src/client/app/shared/toolbar/toolbar.component.html[1, 36]: The property "lang" that you're trying to access does not exist in the class declaration.

Using codelyzer 2.0.0-beta.3

@mgechev
Copy link
Owner

mgechev commented Dec 20, 2016

It seems lang is not defined, and codelyzer is correct in this case. I saw a couple of examples of the translate pipe where it uses a missing lang property, which is later passed to a method of a service that as default argument uses the default locale. I didn't find a definition of a local view property through setting a property of the current context.

Does your code work with AoT compilation? If it does, what starter do you use?

Let me know if my findings are missig something.

@mgechev mgechev closed this as completed Dec 20, 2016
@emilio-simoes
Copy link
Author

emilio-simoes commented Dec 20, 2016

Yes, the code is working with AoT compilation. The translations are working fine both with Aot and JIT compilations.

I don't think is an issue os the lang not being defined since the angular2localization explicitly defines it. See https://github.com/robisim74/angular2localization/blob/master/doc/spec.md#2.

The translation won't even work if lang is omitted when using parameters, e.g.:

<h1>{{ 'toolbar.title' | translate:lang:{version:2} }}</h1>

@emilio-simoes
Copy link
Author

I've been looking into it and it seems that this issues is related with issue #191

My component is extending angular2localization Locale wich defines lang, so langis definitely defined.

@mgechev
Copy link
Owner

mgechev commented Dec 20, 2016

@emilio-simoes thanks for the insight. I'll work on support for extended classes in the next release.

@iliketomatoes
Copy link

This is still an issue in Codelyzer 3.0.0.

@magnattic
Copy link

Can confirm, please reopen the issue.

@mgechev
Copy link
Owner

mgechev commented Apr 26, 2017

#297 (comment)

If you need type checking (support for inheritance, etc.) you should switch back to the beta version. Another problem here is that the linting gets very slow.

Keeping the performance in mind, I'm not sure if we should perform a flat or deep analysis of the application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants