Follow-up to #289.
scripts/generate-version.ts emits string literals via JSON.stringify(...) as part of the PR's defense-in-depth hardening. That produces double-quoted strings, which prettier rejects in src/version.ts.
Current workaround
src/version.ts was added to the eslint ignores list (commit on the rebased PR branch). The file is .gitignored and regenerated on every build, so the ignore is correct in practice.
Open risk
If anyone later runs prettier directly on src/version.ts, or wires the generated file into a non-eslint format check (CI step, pre-commit hook, etc.), the format check will fail. The workaround is invisible to non-eslint tooling.
Options
- Keep
JSON.stringify and document the eslint-only carve-out — current state. Defense-in-depth preserved.
- Switch to single-quoted output in
scripts/generate-version.ts. Safe because validateVersion constrains the emitted strings to a regex that excludes ', \\, and other shell-meaningful characters. Removes the prettier carve-out.
- Run prettier on the generated file as a post-step in
scripts/generate-version.ts before writing. More machinery, no defense-in-depth loss.
Option (2) is the cheapest if the regex is the source of truth, but it depends on VERSION_REGEX actually constraining the values (see #368 for the related extraction work).
Follow-up to #289.
scripts/generate-version.tsemits string literals viaJSON.stringify(...)as part of the PR's defense-in-depth hardening. That produces double-quoted strings, which prettier rejects insrc/version.ts.Current workaround
src/version.tswas added to the eslintignoreslist (commit on the rebased PR branch). The file is.gitignored and regenerated on every build, so the ignore is correct in practice.Open risk
If anyone later runs prettier directly on
src/version.ts, or wires the generated file into a non-eslint format check (CI step, pre-commit hook, etc.), the format check will fail. The workaround is invisible to non-eslint tooling.Options
JSON.stringifyand document the eslint-only carve-out — current state. Defense-in-depth preserved.scripts/generate-version.ts. Safe becausevalidateVersionconstrains the emitted strings to a regex that excludes',\\, and other shell-meaningful characters. Removes the prettier carve-out.scripts/generate-version.tsbefore writing. More machinery, no defense-in-depth loss.Option (2) is the cheapest if the regex is the source of truth, but it depends on
VERSION_REGEXactually constraining the values (see #368 for the related extraction work).