/eslint-plugin-vanta

Vanta's eslint plugin

Primary LanguageTypeScriptApache License 2.0Apache-2.0

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 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"]
}

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

{
  "rules": {
    "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