Files
roshan 787109f4f9 chore(lint): ban em dashes in strings and JSX text (#16600)
## Description

Part 4 of 4. Adds `anti-slop/no-em-dash`, ported from t3code. It flags
em dashes in string literals, template strings, and JSX text. Comments
are not checked.

One change from t3code's version: a string that is only an em dash is
allowed. About 25 hits were the empty-value placeholder in tables and
stats, and that is not prose.

The 90 remaining hits now use a period, comma, colon, or parentheses.
They are in product copy, stories, test titles, and scripts.
User-visible changes:
- Browser tab titles use ` | ` as the separator: `Admin | Onyx` and
`<chat name> | Onyx`.
- The invite timeout and invalid-skill messages are now two sentences.
All 9 locale files have the new invalid-skill string, as the i18n
copy-change hook requires.

## How Has This Been Tested?

- `bun run lint` exits 0.
- A fixture string with an em dash in prose gets a report. A lone `"—"`
does not.
- The changed jest files and `src/i18n` pass.
- Pre-commit passes, including the i18n copy-change and TypeScript
checks.
- Not run: the Playwright specs. Only their test titles, log text, and
fixture text changed.

## Additional Options

- [ ] [Optional] Please cherry-pick this PR to the latest release
version.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Style**
* Standardized punctuation across app titles, validation and error
messages, and example content, replacing em dashes with clearer
separators.
* Updated invalid-skill messages across supported languages while
preserving their instructions.
* Text checks now flag em dashes in displayed content to help maintain
consistent punctuation.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-10-22 23:44:26 +00:00

51 lines
2.0 KiB
JavaScript

// Local dev watcher for @onyx-ai/shared. Rebuilds dist/ on edits:
// - src/** -> tsc --watch (incremental rebuild of JS + d.ts)
// - tokens/**.json -> Style Dictionary token build, THEN re-inlines the result
// into Opal's dist (bundle-css) so the web dev server — which
// consumes opal/dist/root.css, not shared/dist — hot-reloads.
//
// Run with `bun run dev` (pair it with web's `bun run dev`). Dev convenience only,
// never used by CI/build. Note: recursive fs.watch works on macOS/Windows; on Linux,
// re-run `bun run build:tokens` (then opal's `bun run build`) after editing tokens.
import { spawn } from "node:child_process";
import { watch } from "node:fs";
import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";
const root = resolve(dirname(fileURLToPath(import.meta.url)), "..");
const opalRoot = resolve(root, "..", "opal");
const run = (script, extra = []) =>
spawn("bun", ["run", script, ...extra], { cwd: root, stdio: "inherit" });
// Rebuild tokens, then re-inline them into Opal's dist/root.css. Opal bakes shared's
// CSS in at build time, so the web dev server only sees a token change once Opal is
// re-bundled. bundle-css.mjs is pure Node and fast, so chaining it here is cheap.
function rebuildTokens() {
spawn("bun", ["run", "build:tokens"], { cwd: root, stdio: "inherit" }).on(
"exit",
(code) => {
if (code === 0) {
spawn("node", ["scripts/bundle-css.mjs"], {
cwd: opalRoot,
stdio: "inherit",
});
}
}
);
}
rebuildTokens(); // initial token build (+ Opal re-inline)
run("build:ts", ["--", "--watch", "--preserveWatchOutput"]); // incremental TS watch
let timer;
watch(resolve(root, "tokens"), { recursive: true }, (_event, file) => {
if (file && !file.endsWith(".json")) return;
clearTimeout(timer);
timer = setTimeout(rebuildTokens, 150);
});
console.log(
"[shared] watching src/ (tsc) + tokens/ (style-dictionary): Ctrl-C to stop"
);