eslint-plugin-oclif v0.1.0
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 andoclif
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
Create
src/rules/<your-rule-here.ts>
- This file contains logic for our new rule.
Create
docs/rules/<your-rule-here.md>
- This file contains the documentation for our new rule.
Add the new rule in
src/rules/index.ts
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago