V1.1.0 #12

Merged
irammini merged 9 commits from dev into main 2026-02-05 15:38:01 +00:00
irammini commented 2026-02-05 13:54:55 +00:00 (Migrated from github.com)

feat: Upgrade syntax highlighting module

feat: Upgrade syntax highlighting module
github-code-quality[bot] (Migrated from github.com) reviewed 2026-02-05 13:56:18 +00:00
@ -94,52 +95,68 @@ export class CodePrompt extends Prompt<string, CodeOptions> {
const shouldHighlight = this.options.highlight !== false;
github-code-quality[bot] (Migrated from github.com) commented 2026-02-05 13:56:18 +00:00

Unused variable, import, function or class

Unused variable currentAnsi.


In general, unused local variables should either be removed or, if they represent an intended but not yet implemented feature, be put to actual use. Since currentAnsi is not used anywhere and there is no clear behavior missing from the method, the safest fix that does not change existing functionality is simply to remove the variable declaration.

Concretely, in src/prompts/code.ts inside the render method’s highlighting block, remove let currentAnsi = ''; on line 102. No additional imports, methods, or definitions are needed; the rest of the logic already operates correctly using sequence, activeColor, and highlighted. This will eliminate the CodeQL warning without changing runtime behavior.

## Unused variable, import, function or class Unused variable currentAnsi. --- In general, unused local variables should either be removed or, if they represent an intended but not yet implemented feature, be put to actual use. Since <code>currentAnsi</code> is not used anywhere and there is no clear behavior missing from the method, the safest fix that does not change existing functionality is simply to remove the variable declaration.</p> <p>Concretely, in <code>src/prompts/code.ts</code> inside the <code>render</code> method’s highlighting block, remove <code>let currentAnsi = '';</code> on line 102. No additional imports, methods, or definitions are needed; the rest of the logic already operates correctly using <code>sequence</code>, <code>activeColor</code>, and <code>highlighted</code>. This will eliminate the CodeQL warning without changing runtime behavior.
@ -0,0 +1,206 @@
import { highlight, highlightEnv, highlightToml, highlightJson, highlightCsv, highlightShell, highlightProperties } from '../src/highlight';
github-code-quality[bot] (Migrated from github.com) commented 2026-02-05 13:56:18 +00:00

Unused variable, import, function or class

Unused variable expected.


In general, an unused variable should either be removed or used. To avoid changing existing functionality, the simplest and safest fix here is to remove the unused expected variable in the highlightJson "should highlight keys" test while keeping its explanatory comments, since the test currently uses toContain assertions that do not depend on expected.

Concretely, in test/highlight.test.ts, inside the describe('highlightJson', ...) block, in the it('should highlight keys', ...) test, delete the const expected = ... declaration and its continuation lines (66–71). Keep the surrounding comments that describe the regex behavior if they are useful, but ensure there is no remaining expected identifier that’s not used. No imports or additional methods are needed.

## Unused variable, import, function or class Unused variable expected. --- In general, an unused variable should either be removed or used. To avoid changing existing functionality, the simplest and safest fix here is to remove the unused <code>expected</code> variable in the <code>highlightJson</code> "should highlight keys" test while keeping its explanatory comments, since the test currently uses <code>toContain</code> assertions that do not depend on <code>expected</code>.</p> <p>Concretely, in <code>test/highlight.test.ts</code>, inside the <code>describe('highlightJson', ...)</code> block, in the <code>it('should highlight keys', ...)</code> test, delete the <code>const expected = ...</code> declaration and its continuation lines (66–71). Keep the surrounding comments that describe the regex behavior if they are useful, but ensure there is no remaining <code>expected</code> identifier that’s not used. No imports or additional methods are needed.
irammini commented 2026-02-05 14:45:46 +00:00 (Migrated from github.com)

In this commit:

  • Added unit tests for highlightCsv, highlightShell, and highlightProperties in test/highlight.test.ts.
  • Updated CodeOptions in src/types.ts to include csv, sh, bash, zsh, properties, props, and conf.
  • Added new demos for CSV, Shell Script, and Properties files in examples/code-prompt.ts.
  • Updated existing highlightToml tests to match current implementation behavior.
In this commit: - Added unit tests for `highlightCsv`, `highlightShell`, and `highlightProperties` in `test/highlight.test.ts`. - Updated `CodeOptions` in `src/types.ts` to include `csv`, `sh`, `bash`, `zsh`, `properties`, `props`, and `conf`. - Added new demos for CSV, Shell Script, and Properties files in `examples/code-prompt.ts`. - Updated existing `highlightToml` tests to match current implementation behavior.
Sign in to join this conversation.
No description provided.