UNPKG

refakts

Version:

TypeScript refactoring tool built for AI coding agents to perform precise refactoring operations via command line instead of requiring complete code regeneration.

35 lines 1.27 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.unusedMethodCheck = void 0; const child_process_1 = require("child_process"); const util_1 = require("util"); const execAsync = (0, util_1.promisify)(child_process_1.exec); exports.unusedMethodCheck = { name: 'unusedMethod', check: async () => { try { const members = await getUnusedClassMembers(); return members.map(toQualityIssue); } catch { return []; } }, getGroupDefinition: (groupKey) => groupKey === 'unusedMethod' ? { title: 'UNUSED CODE', description: 'Dead code reduces codebase clarity and increases maintenance burden.', actionGuidance: 'Remove these unused methods to maintain codebase clarity.' } : undefined }; const getUnusedClassMembers = async () => { const { stdout } = await execAsync('npx knip --include classMembers --reporter json'); const output = JSON.parse(stdout); return output.issues?.classMembers || []; }; const toQualityIssue = (member) => ({ type: 'unusedMethod', severity: 'critical', message: `Unused method '${member.name}' in ${member.file}`, file: member.file }); //# sourceMappingURL=unused-method-check.js.map