2026-07-08 20:37:59 +02:00
|
|
|
// 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" },
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
2026-07-08 20:44:52 +02:00
|
|
|
// 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"],
|
2026-07-08 20:37:59 +02:00
|
|
|
rules: {
|
|
|
|
|
"no-restricted-imports": [
|
|
|
|
|
"error",
|
|
|
|
|
{
|
|
|
|
|
paths: VIEWER_LIBS.map((name) => ({
|
|
|
|
|
name,
|
|
|
|
|
message: "Viewer libraries are confined to src/pdf/ (adapter boundary).",
|
|
|
|
|
})),
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
);
|