NativeScript / NativeScript/nativescript-cli

Angular src/app/package.json causing tslint error

オープン
#4,575 コメント 2 件 リアクション 2 件 担当者 1 名 GitHub で見る

@rosen-vladimirov がすでに取り組んでいます。

2019年5月7日 から。

主要言語
JavaScript
スター
1.1k
フォーク
204
平均マージ
1日 9時間
マージ済み PR(30日)
8

説明

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

  1. tns create ns-tab-example
  2. Choose Angular project AND tab navigation temlpate
  3. Open src/app/home/home.component.ts in a tslint supported IDE (like VS Code)
  4. See no-implicit-dependencies on the @angular/core import

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).

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。