Skip to content
This repository has been archived by the owner on Mar 15, 2023. It is now read-only.

VantaInc/eslint-plugin-vanta

Repository files navigation

eslint-plugin-vanta

Custom ESLint rules for Vanta. The TypeScript rules assume the existence of certain primitives, like the Maybe type, and may not be useful to codebases other than Vanta's. The GraphQL rules enforce various invariants described in our GraphQL style guide.

Style guide

The public version of our GraphQL style guide can be found here.

Installation

You'll first need to install ESLint:

$ npm i eslint --save-dev

Next, install eslint-plugin-vanta:

$ npm install @vanta-inc/eslint-plugin-vanta --save-dev

Usage

Add vanta to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
  "plugins": ["@vanta-inc/eslint-plugin-vanta"]
}

Then configure the rules you want to use under the rules section.

{
  "rules": {
    "@vanta-inc/vanta/rule-name": 2
  }
}

Creating a new rule

  • Rule definitions live in /lib/rules/<rule-name>.ts
  • Tests live in /tests/lib/rules/<rule-name>.test.ts
  • Documentation lives in /docs/rules/<rule-name>.md

Hot tips:

Supported Rules

TypeScript

GraphQL