Socket
Book a DemoInstallSign in
Socket

ng-d-lint

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng-d-lint

AngularJS Dependency Injection linter

0.1.0
latest
Source
npmnpm
Version published
Weekly downloads
4
Maintainers
1
Weekly downloads
 
Created
Source

ng-dependency-lint Build Status

Remove unused dependency injections automatically

Removing unused dependency injections when you use hundreds of components can be tedious task. This script aims to automate the process for you.

Why would I remove unused dependencies?

1. Maintanance

Cleaning up your code is always a good idea. It's easier to see the architecture looking at component definition.

2. Performance

AngularJS dependencies are lazy loaded. This means that any code of service that you inject into your component won't be run until you inject that service. Therefore in some situations removing unused dependency injections might induce performance boost.

3. Metadata

AngularJS dependencies contain potential metadata that can be used by 3rd party plugins / software. Cleaning up injected dependency list keep this metadata accurate.

How to use ng-dependency-lint

Build systems

Standalone

You can also use this ng-dependency-lint as a standalone tool, to do that, install via npm:

npm install -g ng-dependency-lint

Then you can use this script in 2 modes:

1. Print mode

You can use it similarly to lint tool - any unused dependencies will be printed on gulp / grunt console, leaving you to update the code.

To run this,

ng-dependency-lint somefile.js
2. Update mode

The code can be automatically updated - unused dependencies can be removed from code automatically.

To run this

ng-dependency-lint -u somefile.js

FAQ

#####1. Does it work with string array dependency syntax?

No, I think it's a bad idea to annotate dependencies manually, so ng-dependency-lint doesn't support it. You can use this free awesome DI annotator after your code is processed by ng-dependency-lint: https://github.com/olov/ng-annotate

Keywords

angularjs

FAQs

Package last updated on 09 Aug 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.