securityos/node_modules/eslint-plugin-unicorn/rules/utils/create-deprecated-rules.js

26 lines
665 B
JavaScript
Raw Permalink Normal View History

2024-09-06 15:32:35 +00:00
'use strict';
const packageJson = require('../../package.json');
const repoUrl = 'https://github.com/sindresorhus/eslint-plugin-unicorn';
/** @returns {{ [ruleName: string]: import('eslint').Rule.RuleModule }} */
function createDeprecatedRules(data) {
return Object.fromEntries(
Object.entries(data).map(([ruleId, replacedBy = []]) => [
ruleId,
{
create: () => ({}),
meta: {
docs: {
url: `${repoUrl}/blob/v${packageJson.version}/docs/deprecated-rules.md#${ruleId}`,
},
deprecated: true,
replacedBy: Array.isArray(replacedBy) ? replacedBy : [replacedBy],
},
},
]),
);
}
module.exports = createDeprecatedRules;