eslint-plugin-oclif

0.1.0 • Public • Published

eslint-plugin-oclif

This is a linter plugin for the oclif which is a framework for building CLIs in Javascript and Typescript.

Getting Started

Installing in your Project

The version range of TypeScript currently supported by this plugin is >=3.2.1 <3.6.0.

  • yarn add -D eslint@5.16.0 typescript @typescript-eslint/parser @typescript-eslint/eslint-plugin

  • yarn add -D eslint-plugin-oclif

  • Add @typescript-eslint/parser to the parser field and oclif to the plugins section of your .eslintrc configuration file:

    • If your CLI is in JavaScript
    {
        "parser": "@typescript-eslint/parser",
        "plugins": ["oclif"],
        "rules": {
            // Add your rules here
        }
    }

    Add script in package.json

    "scripts":{
        "lint": "eslint . --ext .js"
    }
    • If your CLI is in TypeScript
    {
        "parser": "@typescript-eslint/parser",
        "plugins": ["oclif"],
        "parserOptions": {
            "project": "./tsconfig.json",
            "sourceType": "module",
        },
        "rules": {
            // Add your rules here
        }
    }

    Add script in package.json

    "scripts":{
        "lint": "eslint . --ext .ts"
    }
  • yarn lint

Adding New Rules

  1. Create src/rules/<your-rule-here.ts>

    • This file contains logic for our new rule.
  2. Create docs/rules/<your-rule-here.md>

    • This file contains the documentation for our new rule.
  3. Add the new rule in src/rules/index.ts

Package Sidebar

Install

npm i eslint-plugin-oclif

Weekly Downloads

262

Version

0.1.0

License

MIT

Unpacked Size

25.3 kB

Total Files

19

Last publish

Collaborators

  • c1ph3r