mirror of
https://github.com/bitwarden/browser.git
synced 2025-02-18 01:41:27 +01:00
Prevent banned imports into libs/common (#3599)
Also fix typescript-eslint/parser config and fix linting errors
This commit is contained in:
parent
22a878792e
commit
5ffa3ccd20
@ -4,7 +4,7 @@
|
|||||||
"browser": true,
|
"browser": true,
|
||||||
"webextensions": true
|
"webextensions": true
|
||||||
},
|
},
|
||||||
"plugins": ["@typescript-eslint", "rxjs", "rxjs-angular"],
|
"plugins": ["@typescript-eslint", "rxjs", "rxjs-angular", "import"],
|
||||||
"parser": "@typescript-eslint/parser",
|
"parser": "@typescript-eslint/parser",
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
"project": ["./tsconfig.eslint.json"],
|
"project": ["./tsconfig.eslint.json"],
|
||||||
@ -18,6 +18,16 @@
|
|||||||
"prettier",
|
"prettier",
|
||||||
"plugin:rxjs/recommended"
|
"plugin:rxjs/recommended"
|
||||||
],
|
],
|
||||||
|
"settings": {
|
||||||
|
"import/parsers": {
|
||||||
|
"@typescript-eslint/parser": [".ts"]
|
||||||
|
},
|
||||||
|
"import/resolver": {
|
||||||
|
"typescript": {
|
||||||
|
"alwaysTryTypes": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
"@typescript-eslint/no-explicit-any": "off", // TODO: This should be re-enabled
|
"@typescript-eslint/no-explicit-any": "off", // TODO: This should be re-enabled
|
||||||
"@typescript-eslint/no-unused-vars": ["error", { "args": "none" }],
|
"@typescript-eslint/no-unused-vars": ["error", { "args": "none" }],
|
||||||
@ -65,6 +75,27 @@
|
|||||||
"selector": "CallExpression[callee.name='svgIcon']"
|
"selector": "CallExpression[callee.name='svgIcon']"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"curly": ["error", "all"]
|
"curly": ["error", "all"],
|
||||||
|
"import/namespace": ["off"], // This doesn't resolve namespace imports correctly, but TS will throw for this anyway
|
||||||
|
"import/no-restricted-paths": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"zones": [
|
||||||
|
// Do not allow angular/node/electron code to be imported into common
|
||||||
|
{
|
||||||
|
"target": "./libs/common/**/*",
|
||||||
|
"from": "./libs/angular/**/*"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"target": "./libs/common/**/*",
|
||||||
|
"from": "./libs/node/**/*"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"target": "./libs/common/**/*",
|
||||||
|
"from": "./libs/electron/**/*"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import Substitute, { Arg, SubstituteOf } from "@fluffy-spoon/substitute";
|
import { Substitute, Arg, SubstituteOf } from "@fluffy-spoon/substitute";
|
||||||
|
|
||||||
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import Substitute, { Arg } from "@fluffy-spoon/substitute";
|
import { Substitute, Arg } from "@fluffy-spoon/substitute";
|
||||||
|
|
||||||
import { CipherRepromptType } from "@bitwarden/common/enums/cipherRepromptType";
|
import { CipherRepromptType } from "@bitwarden/common/enums/cipherRepromptType";
|
||||||
import { CipherType } from "@bitwarden/common/enums/cipherType";
|
import { CipherType } from "@bitwarden/common/enums/cipherType";
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import Substitute, { Arg } from "@fluffy-spoon/substitute";
|
import { Substitute, Arg } from "@fluffy-spoon/substitute";
|
||||||
import { mock, MockProxy } from "jest-mock-extended";
|
import { mock, MockProxy } from "jest-mock-extended";
|
||||||
|
|
||||||
import { AbstractEncryptService } from "@bitwarden/common/abstractions/abstractEncrypt.service";
|
import { AbstractEncryptService } from "@bitwarden/common/abstractions/abstractEncrypt.service";
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import Substitute, { Arg } from "@fluffy-spoon/substitute";
|
import { Substitute, Arg } from "@fluffy-spoon/substitute";
|
||||||
|
|
||||||
import { UriMatchType } from "@bitwarden/common/enums/uriMatchType";
|
import { UriMatchType } from "@bitwarden/common/enums/uriMatchType";
|
||||||
import { LoginData } from "@bitwarden/common/models/data/loginData";
|
import { LoginData } from "@bitwarden/common/models/data/loginData";
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import Substitute, { Arg, SubstituteOf } from "@fluffy-spoon/substitute";
|
import { Substitute, Arg, SubstituteOf } from "@fluffy-spoon/substitute";
|
||||||
|
|
||||||
import { AbstractEncryptService } from "@bitwarden/common/abstractions/abstractEncrypt.service";
|
import { AbstractEncryptService } from "@bitwarden/common/abstractions/abstractEncrypt.service";
|
||||||
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import Substitute, { Arg } from "@fluffy-spoon/substitute";
|
import { Substitute, Arg } from "@fluffy-spoon/substitute";
|
||||||
|
|
||||||
import { SendType } from "@bitwarden/common/enums/sendType";
|
import { SendType } from "@bitwarden/common/enums/sendType";
|
||||||
import { SendAccess } from "@bitwarden/common/models/domain/sendAccess";
|
import { SendAccess } from "@bitwarden/common/models/domain/sendAccess";
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import Substitute, { SubstituteOf } from "@fluffy-spoon/substitute";
|
import { Substitute, SubstituteOf } from "@fluffy-spoon/substitute";
|
||||||
|
|
||||||
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
||||||
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import Substitute, { Arg } from "@fluffy-spoon/substitute";
|
import { Substitute, Arg } from "@fluffy-spoon/substitute";
|
||||||
|
|
||||||
import { EncString } from "@bitwarden/common/models/domain/encString";
|
import { EncString } from "@bitwarden/common/models/domain/encString";
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import Substitute from "@fluffy-spoon/substitute";
|
import { Substitute } from "@fluffy-spoon/substitute";
|
||||||
|
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { Utils } from "@bitwarden/common/misc/utils";
|
import { Utils } from "@bitwarden/common/misc/utils";
|
||||||
|
Loading…
Reference in New Issue
Block a user