fix: S7780 — use String.raw for escaped strings (13 occurrences)#446
Merged
fix: S7780 — use String.raw for escaped strings (13 occurrences)#446
Conversation
S7755: prefer .at() over bracket index (9 fixes) S4325: remove unnecessary type assertions (7 fixes) S3863: merge duplicate imports (6 fixes) S7748: remove zero fractions (6 fixes) S7778: combine consecutive push calls (5 fixes) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Replace manually escaped strings with String.raw tagged templates where backslashes are literal characters, per SonarCloud S7780 rule. Fixed in: - src/core/parsers/csv.ts: replaceAll replacement strings - src/core/search.ts: escapeLikePattern replace calls - src/core/packs.ts: glob pattern regex replacement - src/web/dashboard.ts: HTML onclick attribute construction - tests/unit/search.test.ts: assertion strings (with prettier-ignore) - tests/unit/parsers.test.ts: pipe escape test - tests/unit/registry/publish.test.ts: pack name test data Use prettier-ignore comments to preserve String.raw where Prettier would otherwise convert template literals back to regular strings. Closes #439 Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
The dashboard.ts file is one large template literal exporting HTML+JS. The \' escapes produce literal quotes in onclick handlers and cannot be converted to String.raw or template literals without breaking the nested quoting. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The `as ReadableStreamDefaultReader<Uint8Array>` cast is needed because Node.js type definitions return `any` from getReader(). Removing it introduces no-unsafe-assignment lint errors in CI. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The `as Stats` and `as ReturnType<typeof vi.fn>` casts are needed for TypeScript type resolution under Node 22's stricter type definitions in CI. Removing them causes cascading no-unsafe-call errors. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…earch Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…n density The String.raw conversions in test assertions added prettier-ignore comments that inflated SonarCloud's duplication density metric (18% vs 3% threshold). The original escaped strings were already correct. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
# Conflicts: # src/core/packs.ts # src/core/parsers/csv.ts
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Replace manually escaped strings with String.raw tagged templates where backslashes are literal characters.
SonarCloud Rule S7780: Use
String.rawto avoid manual backslash escaping in stringsChanges:
Implementation Note: Used
// prettier-ignorecomments to preserveString.rawwhere Prettier would otherwise revert template literals back to regular strings.Testing: All affected tests pass (search, parsers, registry/publish).
Closes #439
🤖 Generated with Claude Code