I just created a fresh project using @angular/cli (latest version - 1.1.3) and I'm facing some issues with codelyzer.
Let's see the code what I have right now:
app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
private title = 'app'; // Should warn here
}
app.component.css:
spam { // Intentionally wrong to warn errors
color: red;
}
app.component.html:
<h1>Welcome to {{title}}!!</h1>
tslint.json: (only codelyzer part):
"use-input-property-decorator": true,
"use-output-property-decorator": true,
"use-host-property-decorator": true,
"no-input-rename": true,
"no-output-rename": true,
"use-life-cycle-interface": true,
"use-pipe-transform-interface": true,
"component-class-suffix": true,
"directive-class-suffix": true,
"no-access-missing-member": true,
"templates-use-public": true,
"invoke-injectable": true,
"no-unused-css": true
After ran ng lint
:
Actual behavior:
All files pass linting.
Expected behavior:
Warns the rule "templates-use-public":
- There's a private variable that is used in HTML;
Warns the rule "no-unused-css":
- The CSS isn't being used;
Note that these examples are just a few of the ones I've tried. In fact, it seems like codelyzer isn't watching or reporting any errors in .css or .html files.
Am I missing something? Thanks in advance.