Codelyzer: no-unused-css rule does not identify pseudo classes in CSS

Created on 1 Sep 2017  路  5Comments  路  Source: mgechev/codelyzer

Hi,

I am using the no-unused-css rule of codelyzer in my typescript project.I extend codelyzer in tslint.json and use the various rules in codelyzer.

I am referring to a CSS in the style URL of typescript component. The CSS file has classes with pseudo elements like :hover, :after etc. When I run lint in my project I get errors saying that there are unused styles in CSS which points to the class with pseudo elements.

I also tried various tslint rule flags for disabling the rule like * tslint:disable:no-unused-css*\ in CSS file.
But these rules flags does not seem to work in CSS files.

Any idea how to get rid of this issue?

Most helpful comment

This rule is highly experimental and has a lot of flaws at the moment.

Can you add tslint:disable:no-unused-css in the corresponding typescript file ?

All 5 comments

This rule is highly experimental and has a lot of flaws at the moment.

Can you add tslint:disable:no-unused-css in the corresponding typescript file ?

Lets close the issue for now. There are plenty of corner cases which are not handled in this rule. Probably, it's worth introducing a separate tool for this, which performs analysis over the entire project.

Could a note that this rule is experimental and buggy be added to the rule's documentation? Happy to submit a PR.

There's a note already https://github.com/mgechev/codelyzer#rules-status.

the issue is not resolved yet?
And disabling the rule also not work in css
/* tslint:disable:no-unused-css */

Was this page helpful?
0 / 5 - 0 ratings

Related issues

artaommahe picture artaommahe  路  3Comments

michaeljota picture michaeljota  路  4Comments

QuentinFchx picture QuentinFchx  路  3Comments

lazarljubenovic picture lazarljubenovic  路  4Comments

negberts picture negberts  路  3Comments