# monolinter

> Collection of utilities to lint files accross mono repos

Latest version **1.0.5** (published 2023-10-05) · ISC license · 0 weekly downloads

## Install

```sh
npm install monolinter
pnpm add monolinter
yarn add monolinter
bun add monolinter
```

Provides the command `monolinter`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2023-10-05 |
| First published | 2021-07-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 18.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Andres Aguilar |
| Maintainers | andresesfm |
| Keywords | monorepo, lint, package.json |

## Links

- npm: https://www.npmjs.com/package/monolinter
- Repository: https://github.com/andresesfm/monolinter
- npm.io page: https://npm.io/package/monolinter

## Dependencies (8)

- [eslint](https://npm.io/package/eslint.md) ^7.31.0
- [globby](https://npm.io/package/globby.md) ^11.0.4
- [prettier](https://npm.io/package/prettier.md) ^2.3.2
- [typescript](https://npm.io/package/typescript.md) ^4.3.5
- [@types/glob](https://npm.io/package/@types/glob.md) ^7.1.4
- [cosmiconfig](https://npm.io/package/cosmiconfig.md) ^7.0.0
- [@typescript-eslint/parser](https://npm.io/package/@typescript-eslint/parser.md) ^4.28.4
- [@typescript-eslint/eslint-plugin](https://npm.io/package/@typescript-eslint/eslint-plugin.md) ^4.28.4

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@inrupt/eslint-config-base](https://npm.io/package/@inrupt/eslint-config-base.md) — 4.5K weekly downloads

## Recent versions

- 1.0.5 (latest) — 2023-10-05
- 1.0.4 — 2021-09-17
- 1.0.3 — 2021-09-13
- 1.0.2 — 2021-08-03
- 1.0.1 — 2021-07-26
- 1.0.0 — 2021-07-21

## README

# Monolinter
When woriking in a monorepo, often we find that some subprojects's package dependencies diverge, leading to unexpected results. Monolinter reads all provided `package.json`'s files and validates their consistency. The validation can be run as part of your CI/CD process.

Note: validations are useful / can be applied even if your project only has one `package.json`

Monolinter was designed to be modular and easily extensible with validation modules

## Validation Modules:
- Consistent package versions: Checks that packages declared accross subprojects have matching versions. For example if `app1/package.json` has a dependency to `depA` version `1.0.0` but `app2/package.json` has a dependency to `depA` version `2.0.0` the validation will fail

- Duplicate packages: withing the same file, it prevents duplicate declaration of the same package, this happens accross `devDependencies` and `dependencies`. If the same dependency `depA` is found more than once in dependencies of `package.json`. 

- Exact package versions: prevents using fuzzy versions (starting with `^` or `~`) that might cause inconsistent builds. For example if `package.json` contains `depA` version `^1.0.0` this validation will fail as `^1.0.0` might lead to inconsistencies.

- Related packages: some packages should have matching versions. For example  `"react-native-web"` and `"babel-plugin-react-native-web"`. Hoever there's no way to enforce that until now. Please contribute more such packages to this repo.

## Installation
```
yarn add monolinter -d
```
## Usage
Create a file called `.monolinterrc` in your root folder with the following configuration:
```
{
 "include":["package.json","mypackagespath/**/package.json"]
}
```
the included paths can be glob expressions.

In order to run from command line, you can call it directly instead
```
yarn monolinter package.json [list of globs to other package.json files]
```

# Contributing
Contributions are welcome, please create a PR, open an issue or start a discussion.


Tutorial Credits for creating this package:
https://itnext.io/step-by-step-building-and-publishing-an-npm-typescript-package-44fe7164964c

https://medium.com/wizardnet972/write-a-simple-node-executable-with-typescript-and-vscode-97c58adca02d

https://medium.com/jspoint/creating-cli-executable-global-npm-module-5ef734febe32

---
_Source: https://npm.io/package/monolinter · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
