Description
Please provide us with the following information:
OS?
Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
OSX El Capitan Version 10.11.6
Versions.
Please run
ng --version
. If there's nothing outputted, please run in a Terminal:node --version
and paste the result here:
@angular/cli: 1.0.0-rc.1
node: 6.9.5
os: darwin x64
Repro steps.
Was this an app that wasn't created using the CLI? What change did you do on your code? etc.
- Run
ng new lint-test
- Run
cd lint-test
- Run
ng g component components/test-lint
- Open
src/app/components/test-lint/test-lint.component.ts
and cause one lint error (e.g, use " instead of ') - Run
npm run lint
- Notice how the lint errors are logged twice
The log given by the failure.
Normally this include a stack trace and some more information.
> linting-test@0.0.0 lint /path/to/lint-test
> ng lint
/path/to/lint-test/src/app/components/test-lint/test-lint.component.ts[4, 13]: " should be '
/path/to/lint-test/src/app/components/test-lint/test-lint.component.ts[4, 13]: " should be '
Lint errors found in the listed files.
Mention any other details that might be useful.
Through a bit of trial and error it seems the issue only occurs on files that are nested inside subfolders like components
and are imported to other nested files. In this case it happens out of the box because ng new
generates a test-lint.component.spec.ts
file for each component which has an import { TestLintComponent } from './test-lint.component';
thus causing lint errors on the component to be reported twice.
A temporary fix in my particular case was to remove "include": [ "**/*.spec.ts" ]
from src/tsconfig.spec.json
since linting test specs was a priority to me.
It'd be nice to know more about the cause and if there is a better fix for this dilemma.
Thanks! ^^
Thanks! We'll be in touch soon.