Skip to content

Fix linting errors and add development tooling#11

Merged
alexgrozav merged 1 commit intomainfrom
alexgrozav/fix-lint-errors
Mar 8, 2026
Merged

Fix linting errors and add development tooling#11
alexgrozav merged 1 commit intomainfrom
alexgrozav/fix-lint-errors

Conversation

@alexgrozav
Copy link
Copy Markdown
Owner

Summary

  • Fix no-new-array lint error in scanner.ts by using Array.from instead of new Array()
  • Mark intentional unused variables in test fixtures with eslint-disable-next-line comments
  • Add typecheck script using tsc --noEmit for TypeScript validation
  • Expand .gitignore with standard entries (coverage, logs, env files, OS artifacts)

Test plan

  • Verify linting passes: npm run lint
  • Verify tests pass: npm run test
  • Verify typecheck passes: npm run typecheck

- Fix no-new-array lint error in scanner.ts by using Array.from instead
- Add eslint-disable comments for intentional unused variables in test fixtures
- Add typecheck script using tsc --noEmit
- Expand .gitignore with standard entries (coverage, logs, env files, OS artifacts)
Copilot AI review requested due to automatic review settings March 8, 2026 10:27
@alexgrozav alexgrozav merged commit a73bd84 into main Mar 8, 2026
4 checks passed
@alexgrozav alexgrozav deleted the alexgrozav/fix-lint-errors branch March 8, 2026 10:28
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR focuses on resolving linting issues and improving developer tooling for the TypeScript codebase, including adding a dedicated type-check command and tightening generated-file ignores.

Changes:

  • Replace new Array(len) in stripComments to satisfy linting (no-new-array).
  • Silence intentional no-unused-vars violations in test fixtures via eslint-disable-next-line.
  • Add typecheck script (tsc --noEmit) and expand .gitignore for common generated artifacts.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
vitest.config.ts Consolidates coverage exclude configuration formatting.
src/scanner.ts Updates result buffer initialization in stripComments to address lint rule.
src/tests/fixtures/strings/entry.ts Suppresses unused-vars warnings for fixture-only constants.
src/tests/fixtures/mixed/entry.ts Suppresses unused-vars warnings for fixture-only imports/expressions.
src/tests/fixtures/externals/local.ts Suppresses unused-vars warning for intentionally unused import.
src/tests/fixtures/externals/entry.ts Suppresses unused-vars warnings for intentionally unused external imports.
package.json Adds typecheck script for tsc --noEmit.
.gitignore Ignores common build, coverage, log, and env artifacts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread src/scanner.ts
export function stripComments(code: string): string {
const len = code.length;
const result: string[] = new Array(len);
const result: string[] = Array.from<string>({ length: len });
Copy link

Copilot AI Mar 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Array.from({ length: len }) eagerly creates a dense array of len undefined values, which adds an extra O(n) initialization pass and more memory churn compared to the previous sparse new Array(len). Since result is fully assigned in the loop anyway, consider keeping the array sparse without using the Array constructor (e.g., initialize as [] and set result.length = len) to preserve performance while satisfying no-new-array.

Suggested change
const result: string[] = Array.from<string>({ length: len });
const result: string[] = [];
result.length = len;

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants