59 lines
1.6 KiB
JavaScript
59 lines
1.6 KiB
JavaScript
|
|
// ESLint flat config for evidence-source.
|
||
|
|
//
|
||
|
|
// Enforces the one boundary that matters in this repo: the browser upload
|
||
|
|
// surface (`src/browser/**`) may depend on the headless core (`src/pdf/**`),
|
||
|
|
// but the headless core must never import from `src/browser/**`. That keeps
|
||
|
|
// `src/pdf/` runtime-agnostic (no `URL.createObjectURL`, no `Blob` upload
|
||
|
|
// path) so it loads cleanly in Node and browsers alike.
|
||
|
|
|
||
|
|
import js from "@eslint/js";
|
||
|
|
import tseslint from "typescript-eslint";
|
||
|
|
import importPlugin from "eslint-plugin-import";
|
||
|
|
import globals from "globals";
|
||
|
|
|
||
|
|
export default tseslint.config(
|
||
|
|
{
|
||
|
|
ignores: ["dist/", "node_modules/", "coverage/", "**/*.d.ts"],
|
||
|
|
},
|
||
|
|
js.configs.recommended,
|
||
|
|
...tseslint.configs.recommended,
|
||
|
|
{
|
||
|
|
files: ["src/**/*.ts", "tests/**/*.ts"],
|
||
|
|
languageOptions: {
|
||
|
|
ecmaVersion: 2022,
|
||
|
|
sourceType: "module",
|
||
|
|
globals: { ...globals.node },
|
||
|
|
},
|
||
|
|
plugins: {
|
||
|
|
import: importPlugin,
|
||
|
|
},
|
||
|
|
settings: {
|
||
|
|
"import/resolver": {
|
||
|
|
typescript: { project: "./tsconfig.json" },
|
||
|
|
},
|
||
|
|
},
|
||
|
|
rules: {
|
||
|
|
"no-restricted-imports": [
|
||
|
|
"error",
|
||
|
|
{
|
||
|
|
patterns: [
|
||
|
|
{
|
||
|
|
group: ["**/browser/**", "../browser/*", "./browser/*"],
|
||
|
|
message:
|
||
|
|
"The headless core (src/pdf) must not depend on browser helpers (src/browser).",
|
||
|
|
},
|
||
|
|
],
|
||
|
|
},
|
||
|
|
],
|
||
|
|
},
|
||
|
|
},
|
||
|
|
{
|
||
|
|
// Browser helpers are allowed to reach into the headless core; relax the
|
||
|
|
// guard for tests, which import from anywhere.
|
||
|
|
files: ["src/browser/**/*.ts", "tests/**/*.ts", "src/index.ts"],
|
||
|
|
rules: {
|
||
|
|
"no-restricted-imports": "off",
|
||
|
|
},
|
||
|
|
},
|
||
|
|
);
|