1.0.1 • Published 8 months ago

@arabasta/eslint-plugin-api-documentation v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

@arabasta/eslint-plugin-api-documentation

NPM Version NPM License

ESLint plugin that enforces api documentation.

Installation

Assuming you already have ESLint installed, run:

# npm
npm install --save-dev @arabasta/eslint-plugin-api-documentation

# yarn
yarn add --dev @arabasta/eslint-plugin-api-documentation

# pnpm
pnpm add --save-dev @arabasta/eslint-plugin-api-documentation

Usage

Flat config (eslint.config.js)

// ...
import apiDocumentation from '@arabasta/eslint-plugin-api-documentation';

export default [
  // ...
  apiDocumentation.configs.recommended,
];

Legacy config (.eslintrc)

{
  "extends": [
    // ...
    "plugin:@arabasta/api-documentation/recommended-legacy"
  ]
}

Rules

💼 Configurations enabled in.\ ✅ Set in the recommended configuration.\ 🔧 Automatically fixable by the --fix CLI option.\ 💭 Requires type information.

Name                               Description💼🔧💭
require-example-decoratorrequire @Example decorator when the method returns an array
require-jsdoc-example-for-enum-typerequire JSDoc's @example declaration for enum properties and ban other complex types from having @example declaration💭
require-jsdoc-returnsrequire return statements to be documented💭
require-security-metadatarequire all security definitions in the @Security decorator to be present in the TSOA config
require-tags-metadatarequire all tags in the @Tags decorator to be present in the TSOA config
valid-alternative-responserequire correct response decorators when using alternative responses🔧
valid-alternative-response-typerequire alternative response's first type argument to be the same as its method's return type🔧💭
valid-example-decorator-typerequire @Example decorator's first type argument to be the same as its method's return type💭
valid-response-decorator-typerequire @Response decorator's first type argument to exists and optionally to be one of the allowed types💭
valid-security-decoratorrequire @Response(401) decorator on methods or classes that are affected by the @Security decorator