Closed Martin-Luft closed 5 years ago
Can you provide the lint config section from the project's .angular-cli.json
?
The most likely cause is that the files option is used in combination with the project option. Only one is needed for most use cases. The default new CLI app only includes the project option. If both are used the files option should only include files present within the TS project. Previously files not part of the project were not linted and silently ignored.
@clydin
"lint": [
{
"files": "src/app/**/*.ts",
"project": "src/tsconfig.app.json"
},
{
"files": "src/app/**/*.ts",
"project": "src/tsconfig.spec.json"
},
{
"project": "e2e/tsconfig.e2e.json"
}
],
Having exact same error with:
Angular CLI: 1.5.0
Node: 8.9.0
OS: darwin x64
Angular: 5.0.0
... animations, common, compiler, compiler-cli, core, forms
... http, platform-browser, platform-browser-dynamic
... platform-server, router
@angular/cli: 1.5.0
@angular-devkit/build-optimizer: 0.0.32
@angular-devkit/core: 0.0.20
@angular-devkit/schematics: 0.0.35
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.0
@schematics/angular: 0.1.0
typescript: 2.6.1
webpack: 3.8.1
Same, tslint v 5.8.0 and 5.7.0 do it
Angular CLI: 1.5.0
Node: 6.11.3
OS: linux x64
Angular: 5.0.0
... animations, common, compiler, compiler-cli, core, forms
... http, platform-browser, platform-browser-dynamic
... platform-server, router
@angular/cli: 1.5.0
@angular/language-service: 4.4.6
@angular-devkit/build-optimizer: 0.0.32
@angular-devkit/core: 0.0.20
@angular-devkit/schematics: 0.0.34
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.0
@schematics/angular: 0.1.1
typescript: 2.4.2
webpack: 3.8.1
You can exclude spec and other test files in the lint config for the app.
Here is an example of lint config in the .angular-cli.json
:
...
"lint": [
{
"files": "src/**/*.ts",
"project": "src/tsconfig.app.json",
"exclude": [
"src/**/*.spec.ts",
"src/test/**/*",
"src/test.ts",
"src/wallabyTest.ts"
]
},
{
"files": "src/**/*.spec.ts",
"project": "src/tsconfig.spec.json"
},
{
"files": "e2e/**/*.ts",
"project": "e2e/tsconfig.e2e.json"
}
],
...
Alternatively, remove the files
fields. They are unnecessary unless they are more restrictive than the files described by the project
option's tsconfig (in which case exclude
is a cleaner option). The behavior follows tslint in that the files option has priority over the project option but the project option is still used to retrieve the file. CLI 1.6 will have a more descriptive error message in this case as the current one is misleading.
Thanks for reporting this issue. This issue is now obsolete due to changes in the recent releases. Please update to the most recent Angular CLI version.
If the problem persists after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.
Bug Report or Feature Request (mark with an
x
)Versions.
@angular/cli: 1.5.0-beta.2 node: 7.10.1 os: linux x64 @angular/common: 5.0.0-rc.0 @angular/compiler: 5.0.0-rc.0 @angular/core: 5.0.0-rc.0 @angular/forms: 5.0.0-rc.0 @angular/http: 5.0.0-rc.0 @angular/platform-browser: 5.0.0-rc.0 @angular/platform-browser-dynamic: 5.0.0-rc.0 @angular/router: 5.0.0-rc.0 @angular/cli: 1.5.0-beta.2 @angular/compiler-cli: 5.0.0-rc.0 typescript: 2.5.3
Repro steps.
ng lint
The log given by the failure.
Desired functionality.
ng lint should work as it did in v1.5.0-beta.1
Mention any other details that might be useful.
The .spec.ts files are the problem.