You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
643 B

const plugins = require('./plugins.json');
module.exports = function(ruleKey) {
const [pluginName, ruleName] = ruleKey.split('/');
if (!ruleName) {
return {
exactMatch: true,
url: 'https://eslint.org/docs/rules/' + ruleKey
};
}
const found = plugins[pluginName];
if (!found) {
throw new Error('No documentation found for rule');
}
if (found.docs) {
return {
exactMatch: true,
url: `${found.docs}${ruleName}.md`
};
}
if (found.repository) {
return {
exactMatch: false,
url: found.repository
};
}
throw new Error('No documentation found for rule');
};