From d91830c447eab73378846f13d4bcfc47cbf5b830 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Mon, 20 Jan 2025 11:31:08 +0100 Subject: [PATCH] Enable the `import/no-restricted-paths` ESLint plugin rule for the viewer Code in the `web/` folder cannot import directly from the `src/` folder, since that could result in most (or all) main-thread code being bundled into the viewer, and must rather be imported via the `pdfjs-lib` alias. Let's use ESLint to help enforce this, please find additional details in https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-restricted-paths.md --- eslint.config.mjs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/eslint.config.mjs b/eslint.config.mjs index 6669f072a2f7a..887e013bbdb02 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -91,6 +91,17 @@ export default [ "import/no-empty-named-blocks": "error", "import/no-commonjs": "error", "import/no-mutable-exports": "error", + "import/no-restricted-paths": [ + "error", + { + zones: [ + { + target: "./web", + from: "./src", + }, + ], + }, + ], "import/no-self-import": "error", "import/no-unresolved": [ "error",