From 1adf3e31f0276a030468ce660246a690d53036b2 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 7 Jan 2025 08:00:32 +0000 Subject: [PATCH] chore: control dependency import into `nuxt/app` --- eslint.config.mjs | 49 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/eslint.config.mjs b/eslint.config.mjs index c2e9cb9761..453da60e47 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -166,6 +166,55 @@ export default createConfigForNuxt({ 'no-console': 'off', }, }, + // manually specify dependencies for nuxt browser app + { + files: ['packages/nuxt/src/app/**', 'packages/nuxt/src/(components,head,imports,pages)/runtime/**'], + name: 'local/client-packages', + rules: { + '@typescript-eslint/no-restricted-imports': ['error', { + 'patterns': [ + { + allowTypeImports: true, + group: [ + // disallow everything + '[@a-z]*', + // except certain dependencies + ...[ + // vue ecosystem + '@unhead', + '@vue', + '@vue/shared', + 'vue/server-renderer', + 'vue', + 'vue-router', + // other deps + 'devalue', + 'klona', + // unjs ecosystem + 'defu', + 'ufo', + 'h3', + 'destr', + 'consola', + 'hookable', + 'unctx', + 'cookie-es', + 'perfect-debounce', + 'radix3', + 'ohash', + 'pathe', + 'uncrypto', + // internal deps + 'nuxt/app', + ].map(r => `!${r}`), + '!#[a-z]*/**', // aliases + '!.*/**', // relative imports + ], + }, + ], + }], + }, + }, { files: ['**/fixtures/**', '**/fixture/**'], name: 'local/disables/fixtures',