get-docs-url.js 547 B

12345678910111213141516171819
  1. 'use strict'
  2. const pkg = require('../../package')
  3. const REPO_URL = 'https://github.com/xjamundx/eslint-plugin-promise'
  4. /**
  5. * Generates the URL to documentation for the given rule name. It uses the
  6. * package version to build the link to a tagged version of the
  7. * documentation file.
  8. *
  9. * @param {string} ruleName - Name of the eslint rule
  10. * @returns {string} URL to the documentation for the given rule
  11. */
  12. function getDocsUrl(ruleName) {
  13. return `${REPO_URL}/tree/v${pkg.version}/docs/rules/${ruleName}.md`
  14. }
  15. module.exports = getDocsUrl