2022-05-03 21:45:37 +02:00
|
|
|
{
|
|
|
|
"root": true,
|
|
|
|
"env": {
|
|
|
|
"browser": true,
|
|
|
|
"webextensions": true
|
|
|
|
},
|
2022-09-27 03:17:43 +02:00
|
|
|
"plugins": ["@typescript-eslint", "rxjs", "rxjs-angular", "import"],
|
2022-08-26 18:09:28 +02:00
|
|
|
"parser": "@typescript-eslint/parser",
|
|
|
|
"parserOptions": {
|
|
|
|
"project": ["./tsconfig.eslint.json"],
|
|
|
|
"sourceType": "module"
|
|
|
|
},
|
2022-05-03 21:45:37 +02:00
|
|
|
"extends": [
|
|
|
|
"eslint:recommended",
|
|
|
|
"plugin:@typescript-eslint/recommended",
|
|
|
|
"plugin:import/recommended",
|
|
|
|
"plugin:import/typescript",
|
2022-08-26 18:09:28 +02:00
|
|
|
"prettier",
|
|
|
|
"plugin:rxjs/recommended"
|
2022-05-03 21:45:37 +02:00
|
|
|
],
|
2022-09-27 03:17:43 +02:00
|
|
|
"settings": {
|
|
|
|
"import/parsers": {
|
|
|
|
"@typescript-eslint/parser": [".ts"]
|
|
|
|
},
|
|
|
|
"import/resolver": {
|
|
|
|
"typescript": {
|
|
|
|
"alwaysTryTypes": true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2022-05-03 21:45:37 +02:00
|
|
|
"rules": {
|
|
|
|
"@typescript-eslint/no-explicit-any": "off", // TODO: This should be re-enabled
|
2022-07-22 11:15:10 +02:00
|
|
|
"@typescript-eslint/no-unused-vars": ["error", { "args": "none" }],
|
2022-05-03 21:45:37 +02:00
|
|
|
"@typescript-eslint/explicit-member-accessibility": [
|
|
|
|
"error",
|
|
|
|
{
|
|
|
|
"accessibility": "no-public"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"@typescript-eslint/no-this-alias": [
|
|
|
|
"error",
|
|
|
|
{
|
|
|
|
"allowedNames": ["self"]
|
|
|
|
}
|
|
|
|
],
|
2022-07-22 11:15:10 +02:00
|
|
|
"no-console": "error",
|
2022-05-03 21:45:37 +02:00
|
|
|
"import/no-unresolved": "off", // TODO: Look into turning off once each package is an actual package.
|
|
|
|
"import/order": [
|
|
|
|
"error",
|
|
|
|
{
|
|
|
|
"alphabetize": {
|
|
|
|
"order": "asc"
|
|
|
|
},
|
|
|
|
"newlines-between": "always",
|
|
|
|
"pathGroups": [
|
|
|
|
{
|
2022-06-14 17:10:53 +02:00
|
|
|
"pattern": "@bitwarden/**",
|
2022-05-03 21:45:37 +02:00
|
|
|
"group": "external",
|
|
|
|
"position": "after"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"pattern": "src/**/*",
|
|
|
|
"group": "parent",
|
|
|
|
"position": "before"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"pathGroupsExcludedImportTypes": ["builtin"]
|
|
|
|
}
|
2022-08-26 18:09:28 +02:00
|
|
|
],
|
2022-09-06 08:21:59 +02:00
|
|
|
"rxjs-angular/prefer-takeuntil": "error",
|
|
|
|
"no-restricted-syntax": [
|
|
|
|
"error",
|
|
|
|
{
|
|
|
|
"message": "Calling `svgIcon` directly is not allowed",
|
|
|
|
"selector": "CallExpression[callee.name='svgIcon']"
|
|
|
|
}
|
2022-09-09 09:30:51 +02:00
|
|
|
],
|
2022-09-27 03:17:43 +02:00
|
|
|
"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/**/*"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
2022-09-29 16:38:50 +02:00
|
|
|
],
|
|
|
|
"no-restricted-imports": ["error", { "patterns": ["src/**/*"] }]
|
|
|
|
},
|
|
|
|
"overrides": [
|
|
|
|
{
|
|
|
|
"files": ["libs/common/src/**/*.ts"],
|
|
|
|
"rules": {
|
|
|
|
"no-restricted-imports": ["error", { "patterns": ["@bitwarden/common/*", "src/**/*"] }]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"files": ["libs/components/src/**/*.ts"],
|
|
|
|
"rules": {
|
|
|
|
"no-restricted-imports": ["error", { "patterns": ["@bitwarden/components/*", "src/**/*"] }]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"files": ["libs/angular/src/**/*.ts"],
|
|
|
|
"rules": {
|
|
|
|
"no-restricted-imports": ["error", { "patterns": ["@bitwarden/angular/*", "src/**/*"] }]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"files": ["libs/node/src/**/*.ts"],
|
|
|
|
"rules": {
|
|
|
|
"no-restricted-imports": ["error", { "patterns": ["@bitwarden/node/*", "src/**/*"] }]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"files": ["libs/electron/src/**/*.ts"],
|
|
|
|
"rules": {
|
|
|
|
"no-restricted-imports": ["error", { "patterns": ["@bitwarden/electron/*", "src/**/*"] }]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2022-05-03 21:45:37 +02:00
|
|
|
}
|