Because finding your way through tech debt shouldn't require a real compass
CodeCompass is your trusty guide through the treacherous waters of technical debt and framework migrations. Think of it as a GPS for your codebase, but without the annoying "recalculating..." messages.
Choose your weapon:
# Using pnpm (the cool kids' choice)
pnpm add -D @agoda/code-compass
# Using npm (old reliable)
npm install --save-dev @agoda/code-compass
# Using yarn (if you're feeling classic)
yarn add -D @agoda/code-compass
// eslint.config.js
import { RuleRegistry, registerEnzymeToRTLRules } from '@agoda/code-compass';
// Register migration rules (no compass required)
registerEnzymeToRTLRules();
export default {
// Your existing ESLint config (we promise not to judge)
plugins: ['@typescript-eslint'],
rules: {
// Your rules (the more the merrier)
}
};
# Run ESLint with SARIF output (warning: may reveal uncomfortable truths)
eslint . -f @agoda/code-compass/sarif -o eslint-results.sarif
import { RuleRegistry } from '@agoda/code-compass';
const registry = RuleRegistry.getInstance();
registry.registerRule({
ruleId: 'no-console',
type: 'technical-debt',
estimatedMinutes: 15, // Optimist, aren't we?
category: 'cleanup',
priority: 'low',
rationale: 'Console logs should be removed in production code',
impacts: [
{
area: 'production-quality',
severity: 'medium'
}
]
});
registry.registerRule({
ruleId: 'enzyme-to-rtl/no-shallow',
type: 'migration',
estimatedMinutes: 30, // Time to say goodbye to shallow rendering
category: 'testing',
priority: 'high',
migrationPath: 'enzyme-to-rtl',
rationale: 'Shallow rendering is discouraged in RTL',
resources: [
'https://testing-library.com/docs/react-testing-library/migrate-from-enzyme'
],
impacts: [
{
area: 'test-reliability',
severity: 'high'
}
]
});
import { analyzeTechDebt } from '@agoda/code-compass';
// Parse SARIF file (brace yourself)
const sarifContent = fs.readFileSync('eslint-results.sarif', 'utf8');
const sarifReport = JSON.parse(sarifContent);
// Analyze tech debt (hope you're sitting down)
const analysis = analyzeTechDebt(sarifReport);
console.log('Total estimated minutes:', analysis.totalMinutes);
console.log('By category:', analysis.byCategory);
Lost? Our docs will help you find your way: https://agoda-com.github.io/code-compass/
Got ideas? We'd love to hear them! (Unless it's about adding more console.logs)
git checkout -b feature/amazing-feature
)pnpm install
)pnpm test
)git push origin feature/amazing-feature
)Apache 2.0 (as free as your next migration should be)
Heartfelt thanks to:
Remember: Technical debt is like your laundry - it doesn't go away by ignoring it. Let CodeCompass help you sort it out! π§Ί