Move pdf-viewer-adapter-spike.tsx, scroll-job.ts (+test), highlight-styles.css and debug-textlayer.css into src/pdf/ (the adapter boundary). Rewrite the spike's @shared import to @citation-evidence/engine/shared and its ./types to ../types. Add src/css.d.ts so tsc accepts side-effect .css imports. Decisions: - adapter stays the explicitly-named PdfSpikeViewer spike; promotion to a production PDFViewerAdapter is registered as T06 follow-on work - viewer libs (pdfjs-dist, react, react-pdf-highlighter-plus) confined to src/pdf/ and exposed only via the evidence-anchor/pdf subpath; the root entrypoint stays pure. Boundary enforced by eslint no-restricted-imports. - ported unit suites (pdf-selector-math round-trip + scroll-job retry) serve as the inspectable harness for capture->selectors->resolve->scroll. Verified: pnpm test (30 passed), typecheck, lint all green. README layout updated. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
49 lines
1.3 KiB
JavaScript
49 lines
1.3 KiB
JavaScript
// ESLint flat config — keeps viewer-library imports behind the PDF adapter
|
|
// boundary and the selector/resolution core pure.
|
|
|
|
import js from "@eslint/js";
|
|
import tseslint from "typescript-eslint";
|
|
import importPlugin from "eslint-plugin-import";
|
|
import globals from "globals";
|
|
|
|
const VIEWER_LIBS = ["pdfjs-dist", "react", "react-dom", "react-pdf-highlighter-plus"];
|
|
|
|
export default tseslint.config(
|
|
{
|
|
ignores: ["dist/", "node_modules/", "coverage/", "**/*.d.ts"],
|
|
},
|
|
js.configs.recommended,
|
|
...tseslint.configs.recommended,
|
|
{
|
|
files: ["src/**/*.{ts,tsx}"],
|
|
languageOptions: {
|
|
ecmaVersion: 2022,
|
|
sourceType: "module",
|
|
globals: { ...globals.node, ...globals.browser },
|
|
},
|
|
plugins: {
|
|
import: importPlugin,
|
|
},
|
|
settings: {
|
|
"import/resolver": {
|
|
typescript: { project: "./tsconfig.json" },
|
|
},
|
|
},
|
|
},
|
|
{
|
|
// The pure core (selectors, resolution, adapter-side types) must not pull
|
|
// in any concrete viewer library — those live only under src/pdf/.
|
|
files: ["src/selectors/**/*.ts", "src/types.ts"],
|
|
rules: {
|
|
"no-restricted-imports": [
|
|
"error",
|
|
{
|
|
paths: VIEWER_LIBS.map((name) => ({
|
|
name,
|
|
message: "Viewer libraries are confined to src/pdf/ (adapter boundary).",
|
|
})),
|
|
},
|
|
],
|
|
},
|
|
},
|
|
);
|