eslint-plugin-apidoc

raw JSON →
0.0.7 verified Fri May 01 auth: no javascript

An ESLint plugin for linting apidoc.json configuration files based on API style rules. Version 0.0.7 is the latest release. It provides rules to enforce base URL, contact information, and description presence for APIs and resources. Designed to integrate with ESLint, it allows developers to validate apidoc.json files as part of their linting process. The plugin is minimal, with only a few rules, and requires ESLint as a peer dependency. It is not actively maintained, with no recent updates.

error Error: Failed to load plugin 'apidoc': Cannot find module 'eslint-plugin-apidoc'
cause Plugin not installed or ESLint cannot resolve it.
fix
Run 'npm install eslint-plugin-apidoc --save-dev'
error Error: Cannot read property 'base-url' of undefined
cause Missing 'apidoc/' prefix in rule name.
fix
Use 'apidoc/base-url' instead of 'base-url'
error Parsing error: Unexpected token
cause apidoc.json file is not valid JSON or missing.
fix
Ensure the file is valid JSON and exists.
gotcha Package is not widely maintained; no updates since 2017. May have compatibility issues with modern ESLint versions.
fix Consider forking or using an alternative if issues arise.
gotcha The plugin only works with apidoc.json files; it does not parse inline JSDoc annotations for apiDoc.
fix Ensure your apiDoc configuration is in a separate JSON file.
npm install eslint-plugin-apidoc
yarn add eslint-plugin-apidoc
pnpm add eslint-plugin-apidoc

Shows ESLint configuration to lint apidoc.json using the plugin's three rules.

// .eslintrc.json
{
  "plugins": ["apidoc"],
  "rules": {
    "apidoc/base-url": ["error", { "domain": "example.com" }],
    "apidoc/contact": "error",
    "apidoc/description": "warn"
  }
}

// Run: eslint apidoc.json