ni / ni/javascript-styleguide

README step to add Angular schematic results in incorrect dependencies in package.json

Open
#76 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation
Dominant language
JavaScript
Stars
9
Forks
11
PR merge metrics
No merged PRs in 30d

Description

I started integrating the styleguide into the SystemLink project. When I ran ng add @angular-eslint/schematics as instructed by our README, it modified the package.json and package-lock.json to include these additional dependencies:
image

With NPM 7, I think this behavior is incorrect:

  1. The dependencies are unnecessary, since they are peer dependencies and NPM 7 could automatically install them without cluttering package.json
  2. The dependency versions cause unnecssary conflicts because they are overly specific. For example, the schematic installed "@typescript-eslint/eslint-plugin": "4.28.2" but @ni/eslint-config-typescript needs version "@typescript-eslint/eslint-plugin": "^4.31.0". This results in npm install creating nested node_modules directories to handle the version conflicts and potentially some tools using an unexpected version of those dependencies.

Some possible remedies:

  1. Modify the README to remove the step about ng add @angular-eslint/schematics. I don't think this is a good idea because (I think) the later step to ng g @angular-eslint/schematics:convert-tslint-to-eslint depends on this step.
  2. Add a note to the README saying to revert package[-lock].json changes after adding the schematic if you're using NPM 7+
  3. File a bug to @angular-eslint about the behavior. I couldn't find any existing issues

I'm interested in everyone's thoughts on this, but particularly @TrevorKarjanis.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the README step that instructs users to run ng add @angular-eslint/schematics, then inspect the resulting package.json and package-lock.json changes with NPM 7. Determine which documented behavior or dependency outcome should be corrected and verify it by rerunning the Angular schematic and checking the manifests.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, eslint, typescript
Domain
documentation, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.