1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-06 00:13:28 +00:00

[PM-22629] Forbid importing popup outside (#15168)

Adds an eslint rule forbidding non popup scripts from importing popups. Also added a webpack plugin that throws if it detects @angular inside background output.
This commit is contained in:
Oscar Hinton
2025-06-13 15:54:49 +02:00
committed by GitHub
parent 40cbac350a
commit 70ad4d048b
32 changed files with 126 additions and 11 deletions

View File

@@ -279,6 +279,31 @@ export default tseslint.config(
]),
},
},
// Browser background and content scripts are not allowed to import from the popup directory
{
files: ["apps/browser/src/**/*.ts"],
rules: {
"no-restricted-imports": buildNoRestrictedImports([
"@angular",
"bitwarden_license/**",
"@bitwarden/bit-common/*",
"@bitwarden/bit-web/*",
"**/popup/*",
]),
},
},
// This removes the previous rule forbidding imports from the popup directory
{
files: ["apps/browser/src/**/popup/**/*.ts"],
rules: {
"no-restricted-imports": buildNoRestrictedImports([
"bitwarden_license/**",
"@bitwarden/bit-common/*",
"@bitwarden/bit-web/*",
]),
},
},
{
files: ["libs/nx-plugin/**/*.ts", "libs/nx-plugin/**/*.js"],
rules: {