# gptlint

> A linter with superpowers! Use LLMs to enforce best practices across your codebase in a standardized, configurable, scalable manner.

Latest version **1.6.0** (published 2024-07-24) · MIT license · 0 weekly downloads

## Install

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

Provides the command `gptlint`.

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.6.0 |
| Published | 2024-07-24 |
| First published | 2024-03-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=18 |
| Dependencies | 38 |
| Unpacked size | 866.5 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 297 |
| Author | Travis Fischer |
| Maintainers | fisch0920 |
| Keywords | lint, linter, linting, ai, gpt, llms, code quality, code health, best practices, static analysis |

## Links

- npm: https://www.npmjs.com/package/gptlint
- Repository: https://github.com/gptlint/gptlint
- Homepage: https://gptlint.dev
- Issues: https://github.com/gptlint/gptlint/issues
- npm.io page: https://npm.io/package/gptlint

## Dependencies (38)

- [zod](https://npm.io/package/zod.md) ^3.23.8
- [plur](https://npm.io/package/plur.md) ^5.1.0
- [yaml](https://npm.io/package/yaml.md) ^2.4.5
- [chalk](https://npm.io/package/chalk.md) ^5.3.0
- [cleye](https://npm.io/package/cleye.md) ^1.3.2
- [execa](https://npm.io/package/execa.md) ^9.3.0
- [p-map](https://npm.io/package/p-map.md) ^7.0.2
- [which](https://npm.io/package/which.md) ^4.0.0
- [dotenv](https://npm.io/package/dotenv.md) ^16.4.5
- [globby](https://npm.io/package/globby.md) ^14.0.1
- [tasuku](https://npm.io/package/tasuku.md) ^2.0.1
- [p-retry](https://npm.io/package/p-retry.md) ^6.2.0
- [pkg-dir](https://npm.io/package/pkg-dir.md) ^8.0.0
- [unified](https://npm.io/package/unified.md) ^11.0.5
- [exit-hook](https://npm.io/package/exit-hook.md) ^4.0.0
- [file-type](https://npm.io/package/file-type.md) ^19.0.0
- [type-fest](https://npm.io/package/type-fest.md) ^4.20.1
- [array-uniq](https://npm.io/package/array-uniq.md) ^3.0.0
- [jsonrepair](https://npm.io/package/jsonrepair.md) ^3.8.0
- [multimatch](https://npm.io/package/multimatch.md) ^7.0.0
- [remark-gfm](https://npm.io/package/remark-gfm.md) ^4.0.0
- [hash-object](https://npm.io/package/hash-object.md) ^5.0.1
- [path-exists](https://npm.io/package/path-exists.md) ^5.0.0
- [get-tsconfig](https://npm.io/package/get-tsconfig.md) ^4.7.5
- [remark-parse](https://npm.io/package/remark-parse.md) ^11.0.0
- [unist-util-is](https://npm.io/package/unist-util-is.md) ^6.0.0
- [@dexaai/dexter](https://npm.io/package/@dexaai/dexter.md) ^2.1.0
- [find-cache-dir](https://npm.io/package/find-cache-dir.md) ^5.0.0
- [mdast-util-gfm](https://npm.io/package/mdast-util-gfm.md) ^3.0.0
- [restore-cursor](https://npm.io/package/restore-cursor.md) ^5.0.0
- [tiny-invariant](https://npm.io/package/tiny-invariant.md) ^1.3.3
- [parse-gitignore](https://npm.io/package/parse-gitignore.md) ^2.0.0
- [remark-frontmatter](https://npm.io/package/remark-frontmatter.md) ^5.0.0
- [unist-util-inspect](https://npm.io/package/unist-util-inspect.md) ^8.0.0
- [mdast-util-to-string](https://npm.io/package/mdast-util-to-string.md) ^4.0.0
- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) ^2.2.1
- [mdast-util-to-markdown](https://npm.io/package/mdast-util-to-markdown.md) ^2.1.0
- [fast-json-stable-stringify](https://npm.io/package/fast-json-stable-stringify.md) ^2.1.0

## 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
- [@pandacss/eslint-plugin](https://npm.io/package/@pandacss/eslint-plugin.md) — 18.7K weekly downloads

## Recent versions

- 1.6.0 (latest) — 2024-07-24
- 1.5.4 — 2024-06-18
- 1.5.3 — 2024-05-15
- 1.5.2 — 2024-05-07
- 1.5.1 — 2024-04-26
- 1.5.0 — 2024-04-26
- 1.4.0 — 2024-04-24
- 1.3.1 — 2024-04-23
- 1.3.0 — 2024-04-23
- 1.2.0 — 2024-04-08
- 1.0.2 — 2024-04-05
- 1.0.1 — 2024-03-30
- 1.0.0 — 2024-03-11

## README

<p align="center">
  <a href="https://gptlint.dev"><img alt="How it works" src="/docs/public/gptlint-logo.png" width="256"></a>
</p>

<p align="center">
  <em>Use LLMs to enforce best practices across your codebase.</em>
</p>

<p align="center">
  <a href="https://www.npmjs.com/package/gptlint"><img alt="NPM" src="https://img.shields.io/npm/v/gptlint.svg" /></a>
  <a href="https://github.com/gptlint/gptlint/actions/workflows/test.yml"><img alt="Build Status" src="https://github.com/gptlint/gptlint/actions/workflows/main.yml/badge.svg" /></a>
  <a href="https://github.com/gptlint/gptlint/blob/main/license"><img alt="MIT License" src="https://img.shields.io/badge/license-MIT-blue" /></a>
  <a href="https://prettier.io"><img alt="Prettier Code Formatting" src="https://img.shields.io/badge/code_style-prettier-brightgreen.svg" /></a>
  <a href="https://twitter.com/transitive_bs"><img alt="Discuss on Twitter" src="https://img.shields.io/badge/twitter-discussion-blue" /></a>
</p>

# GPTLint <!-- omit from toc -->

> A fundamentally new approach to code quality. Use LLMs to enforce higher-level best practices across your codebase in a way that takes traditional static analysis tools like `eslint` to the next level.

- [Features](#features)
- [Demo](#demo)
- [How it works](#how-it-works)
- [Getting Started](#getting-started)
- [FAQ](#faq)
- [Citations](#citations)
- [License](#license)

## Features

- ✅️ _enforce higher-level best practices that are impossible with ast-based approaches_
- ✅️ simple markdown format for rules ([example](./rules/prefer-array-at-negative-indexing.md), [spec](https://gptlint.dev/extend/rule-spec))
- ✅️ easy to [disable](https://gptlint.dev/project/faq#how-can-i-disable-a-rule) or [customize](https://gptlint.dev/project/faq#how-can-i-customize-a-built-in-rule) rules
- ✅️ add custom, [project-specific rules](https://gptlint.dev/guide/rule-guidelines#project-specific-rules)
- ✅️ same cli and config format as `eslint`
- ✅️ supports `gptlint.config.js` and inline overrides `/* gptlint-disable */`
- ✅️ content-based caching
- ✅️ outputs LLM stats per run (cost, tokens, etc)
- ✅️ built-in rules are extensively tested w/ [evals](https://gptlint.dev/project/how-it-works#evals)
- ✅️ supports all major [LLM providers](https://gptlint.dev/guide/llm-providers) and [local models](https://gptlint.dev/guide/llm-providers#local-models)
- ✅️ augments `eslint` instead of trying to replace it (_we love eslint!_)
- ✅️ includes [guidelines](https://gptlint.dev/extend/rule-guidelines) for creating your own rules
- ❌ MVP rules are [JS/TS only](https://gptlint.dev/project/limitations#rules-in-the-mvp-are-jsts-only) _for now_
- ❌ MVP rules are [single-file context only](https://gptlint.dev/project/limitations#rules-in-the-mvp-are-single-file-only) _for now_
- ❌ MVP does not support [autofixing](https://gptlint.dev/project/limitations#the-mvp-does-not-support-autofixing-lint-errors) _for now_

## Demo

Here's a demo of `gptlint` running on its own codebase:

<p align="center">
  <img width="640" src="/docs/public/demo.svg">
</p>

Check out our [docs](https://gptlint.dev/guide) to get started.

## How it works

<p align="center">
  <a href="https://gptlint.dev/project/how-it-works"><img alt="How it works" src="/docs/public/how-gptlint-works.png"></a>
</p>

Check out our [docs on how it works](https://gptlint.dev/project/how-it-works) to learn more.

## Getting Started

Installation is simple, with the only external dependency required by default being an OpenAI API key.

Check out our [docs](https://gptlint.dev/guide) to get started.

## FAQ

- [How accurate / reliable is gptlint?](https://gptlint.dev/project/accuracy)
- [How much will it cost to run gptlint on my codebase?](https://gptlint.dev/project/cost)
- [How can I use GPTLint with a custom, local model?](https://gptlint.dev/guide/llm-providers#local-models)
- [How can I use GPTLint with a different LLM provider?](https://gptlint.dev/guide/llm-providers)
- [How can I disable a rule?](https://gptlint.dev/project/faq)
- [How can I disable a rule for a specific file?](https://gptlint.dev/project/faq)
- [How can I disable linting for a specific file?](https://gptlint.dev/project/faq)
- [How can I customize a built-in rule?](https://gptlint.dev/project/faq)
- [Are there file size limits?](https://gptlint.dev/project/faq)
- [What limitations does GPTLint have?](https://gptlint.dev/project/limitations)
- [How does GPTLint compare to ESLint?](https://gptlint.dev/project/faq)
- [What about fine-tuning?](https://gptlint.dev/project/faq)
- [Where can I get support?](https://gptlint.dev/project/faq)

## Citations

```bibtex
@software{agentic2024gptlint,
  title  = {GPTLint},
  author = {Travis Fischer, Scott Silvi},
  year   = {2024},
  month  = {4},
  url    = {https://github.com/gptlint/gptlint}
}
```

Huge shoutout to [Laurentiu Raducu](https://twitter.com/Bitheap_tech) for gifting us the NPM package name. 🙏

## License

MIT © [Travis Fischer](https://twitter.com/transitive_bs)

To stay up to date or learn more, follow [@transitive_bs](https://twitter.com/transitive_bs) on Twitter.

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