https://github.com/rambler-digital-solutions/licenselint
A linter for NPM package licenses to avoid dependencies that not compatible with license of your software
https://github.com/rambler-digital-solutions/licenselint
license license-checking licenselint lint
Last synced: over 1 year ago
JSON representation
A linter for NPM package licenses to avoid dependencies that not compatible with license of your software
- Host: GitHub
- URL: https://github.com/rambler-digital-solutions/licenselint
- Owner: rambler-digital-solutions
- License: mit
- Created: 2023-01-11T16:45:10.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-02-20T08:27:19.000Z (over 2 years ago)
- Last Synced: 2025-02-18T10:02:21.350Z (over 1 year ago)
- Topics: license, license-checking, licenselint, lint
- Language: TypeScript
- Homepage:
- Size: 840 KB
- Stars: 0
- Watchers: 17
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# License Lint
A linter for NPM package licenses to avoid dependencies that not compatible with license of your software. It can check licenses automatically on CI or on NPM `postinstall`.

## Install
```sh
npm install -D @rambler-tech/licenselint
```
or
```sh
yarn add -D @rambler-tech/licenselint
```
## Usage
```sh
licenselint --help
Lint NPM package licenses
Usage
licenselint [dirname]
Options
--production Only lint production dependencies
--development Only lint development dependencies
--summary Output a summary of the license usage
--deny Fail on an occurrence of the licenses of the deny list
--allow Fail on an occurrence of the licenses not in the allow list
--exclude Exclude modules which licenses are in the list
--extends Use custom configuration file
Examples
licenselint
licenselint packages/foo
licenselint --production
licenselint --deny LGPL
licenselint --allow MIT --allow ISC
licenselint --extends shared/licenserc.json
```
Then use it for automatically check in CI
```yaml
...
lint deps:
stage: test
script:
- npm install
- licenselint
...
```
Or on NPM `postinstall`
```json
{
"name": "app",
"description": "...",
"version": "0.1.2",
"scripts": {
"...": "...",
"postinstall": "licenselint"
},
"...": "..."
}
```
## Configuration
Create `.licenserc.json` configuration file:
```json
{
"production": true,
"deny": [
"GPL",
"LGPL"
]
}
```
Configuration file supports all CLI flags.
Also you can extends your local setup with shared configuration:
```json
{
"extends": "@shared/licenserc",
"summary": true
}
```
## License
MIT