NativeScript / NativeScript/nativescript-cli
Angular src/app/package.json causing tslint error
@rosen-vladimirov ya está trabajando en esto.
Desde el 7/5/2019.
- Lenguaje dominante
- JavaScript
- Estrellas
- 1.1k
- Forks
- 204
- Merge medio
- 1 d 9 h
- PR fusionados (30 d)
- 8
Descripción
Environment
tns info
✔ Getting NativeScript components versions information...
✔ Component nativescript has 5.3.4 version and is up to date.
✔ Component tns-core-modules has 5.3.1 version and is up to date.
✔ Component tns-android has 5.3.1 version and is up to date.
✔ Component tns-ios has 5.3.1 version and is up to date.
Describe the bug
Having a package.json in src/app/package.json causes no-implicit-dependencies tslint error
To Reproduce
tns create ns-tab-example- Choose Angular project AND tab navigation temlpate
- Open
src/app/home/home.component.tsin a tslint supported IDE (like VS Code) - See
no-implicit-dependencieson the@angular/coreimport
Expected behavior
no-implicit-dependencies tslint errors should not exist on tns created templates.
Additional context
The problem is there are 2 package.json files in a TNS created Angular project. When tslint goes to find a TS imported module in package.json it 1st finds src/app/package.json with the following contents:
{
"main": "main.js",
"android": {
"v8Flags": "--expose_gc"
}
}
As you can see, the problem is this file has no dependencies defined. Dependencies are defined in the <project root>/package.json file (rightfully so).
So if you import { Component, OnInit } from '@angular/core'; tslint will throw an error like:
Module '@angular/core' is not listed as dependency in package.json (no-implicit-dependencies)
I'm hoping src/app/package.json can be deleted and its contents merged into <project root>/package.json.
tslint errors are a problem for workflows that prohibit commits that fail linting (like CI/CD envs).
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Evaluación
Este issue todavía no se ha evaluado.