Skip to content

Latest commit

 

History

History
149 lines (102 loc) · 3.39 KB

File metadata and controls

149 lines (102 loc) · 3.39 KB

TypeScript Compilation Fixes

Summary

The project has 6 unused variable/function warnings that need to be fixed for clean compilation.

Errors to Fix

1. src/copytabs.ts(10,11) - Unused ProcessedTab interface

Error: 'ProcessedTab' is declared but never used.

Fix: Remove the unused interface

// DELETE THESE LINES (around line 17-20):
interface ProcessedTab {
  content: string;
  error?: string;
}

2. src/copytabs.ts(291,10) - Unused addLineNumbers function

Error: 'addLineNumbers' is declared but its value is never read.

Fix: Remove the unused function

// DELETE THE ENTIRE FUNCTION (around line 291-296):
function addLineNumbers(content: string): string {
  return content
    .split("\n")
    .map((line, index) => `${index + 1} | ${line}`)
    .join("\n");
}

Also remove the call to it in processTabsWithProgress (around line 288):

// CHANGE FROM:
if (settings.includeLineNumbers) {
  processedContent = addLineNumbers(processedContent);
}

// CHANGE TO: (delete these lines)
// Line numbers functionality removed - not currently used

3. src/historyManager.ts(69,13) - Unused loadHistory method

Error: 'loadHistory' is declared but its value is never read.

Fix: Remove the method call in constructor and the method itself

In the constructor (around line 59), change from:

this.loadHistory();

To just remove that line.

Then remove the entire loadHistory() method definition (lines 69+).


4. src/historyView.ts(16,9) - Unused context parameter

Error: 'context' is declared but its value is never read.

Fix: Prefix with underscore to indicate intentionally unused

// CHANGE FROM:
public resolveWebviewView(
  webviewView: vscode.WebviewView,
  context: vscode.WebviewViewResolveContext,
  _token: vscode.CancellationToken
) {

// CHANGE TO:
public resolveWebviewView(
  webviewView: vscode.WebviewView,
  _context: vscode.WebviewViewResolveContext,
  _token: vscode.CancellationToken
) {

5. src/historyView.ts(81,15) - Unused remainingSlots variable

Error: 'remainingSlots' is declared but its value is never read.

Fix: Remove the unused variable

// CHANGE FROM (around line 81):
const isClipboardMode = this.historyManager.isClipboardMode();
const remainingSlots = this.historyManager.getRemainingSlots();
const isAtLimit = history.length >= HISTORY_LIMIT;

// CHANGE TO:
const isClipboardMode = this.historyManager.isClipboardMode();
const isAtLimit = history.length >= HISTORY_LIMIT;

6. src/scripts/validateL10n.ts(44,15) - Unused defaultKeys variable

Error: 'defaultKeys' is declared but its value is never read.

Fix: Remove the unused variable

// CHANGE FROM (around line 44):
const defaultKeys = Object.keys(defaultTranslations);
const packageKeys = Object.keys(packageNlsData);

// CHANGE TO:
const packageKeys = Object.keys(packageNlsData);

Instructions

  1. Open each file in your editor
  2. Find and remove/modify the code as shown above
  3. Save all files
  4. Run: npm run compile
  5. Should see: "Successfully compiled 12 files with TypeScript"

Testing After Fixes

Once compilation succeeds:

npm run lint          # Check for linting issues
npm test             # Run tests
npm run validate-l10n # Validate localization files