1.0.1 • Published 8 months ago
@arabasta/eslint-plugin-api-documentation v1.0.1
@arabasta/eslint-plugin-api-documentation
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-decorator | require @Example decorator when the method returns an array | ✅ | ||
require-jsdoc-example-for-enum-type | require JSDoc's @example declaration for enum properties and ban other complex types from having @example declaration | ✅ | 💭 | |
require-jsdoc-returns | require return statements to be documented | ✅ | 💭 | |
require-security-metadata | require all security definitions in the @Security decorator to be present in the TSOA config | ✅ | ||
require-tags-metadata | require all tags in the @Tags decorator to be present in the TSOA config | ✅ | ||
valid-alternative-response | require correct response decorators when using alternative responses | ✅ | 🔧 | |
valid-alternative-response-type | require alternative response's first type argument to be the same as its method's return type | ✅ | 🔧 | 💭 |
valid-example-decorator-type | require @Example decorator's first type argument to be the same as its method's return type | ✅ | 💭 | |
valid-response-decorator-type | require @Response decorator's first type argument to exists and optionally to be one of the allowed types | ✅ | 💭 | |
valid-security-decorator | require @Response(401) decorator on methods or classes that are affected by the @Security decorator | ✅ |