4

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.

dev_054
  • 3,448
  • 8
  • 29
  • 56
  • hey, did you find a solution for this? I have the same problem - in particular, `template-use-public` is blatantly ignored. – Carlos Romero Jul 11 '17 at 10:16
  • Same problem here with "Angular CLI: 6.0.8", I can't get `ng lint` to output any problems for my html files. – Sam Jun 18 '18 at 07:54

0 Answers0