2022-05-03 21:45:37 +02:00
|
|
|
{
|
|
|
|
"root": true,
|
|
|
|
"env": {
|
|
|
|
"browser": true,
|
|
|
|
"webextensions": true
|
|
|
|
},
|
2023-01-31 18:39:10 +01:00
|
|
|
"overrides": [
|
|
|
|
{
|
|
|
|
"files": ["*.ts", "*.js"],
|
|
|
|
"plugins": ["@typescript-eslint", "rxjs", "rxjs-angular", "import"],
|
|
|
|
"parser": "@typescript-eslint/parser",
|
|
|
|
"parserOptions": {
|
|
|
|
"project": ["./tsconfig.eslint.json"],
|
|
|
|
"sourceType": "module",
|
|
|
|
"ecmaVersion": 2020
|
|
|
|
},
|
|
|
|
"extends": [
|
|
|
|
"eslint:recommended",
|
|
|
|
"plugin:@typescript-eslint/recommended",
|
|
|
|
"plugin:import/recommended",
|
|
|
|
"plugin:import/typescript",
|
|
|
|
"prettier",
|
2023-08-15 19:25:51 +02:00
|
|
|
"plugin:rxjs/recommended",
|
|
|
|
"plugin:storybook/recommended"
|
2023-01-31 18:39:10 +01:00
|
|
|
],
|
|
|
|
"settings": {
|
|
|
|
"import/parsers": {
|
|
|
|
"@typescript-eslint/parser": [".ts"]
|
2022-05-03 21:45:37 +02:00
|
|
|
},
|
2023-01-31 18:39:10 +01:00
|
|
|
"import/resolver": {
|
|
|
|
"typescript": {
|
|
|
|
"alwaysTryTypes": true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"rules": {
|
|
|
|
"@typescript-eslint/explicit-member-accessibility": [
|
|
|
|
"error",
|
2023-09-26 23:07:22 +02:00
|
|
|
{ "accessibility": "no-public" }
|
2022-05-03 21:45:37 +02:00
|
|
|
],
|
2023-09-26 23:07:22 +02:00
|
|
|
"@typescript-eslint/no-explicit-any": "off", // TODO: This should be re-enabled
|
|
|
|
"@typescript-eslint/no-misused-promises": ["error", { "checksVoidReturn": false }],
|
|
|
|
"@typescript-eslint/no-this-alias": ["error", { "allowedNames": ["self"] }],
|
|
|
|
"@typescript-eslint/no-unused-vars": ["error", { "args": "none" }],
|
2023-01-31 18:39:10 +01:00
|
|
|
"no-console": "error",
|
|
|
|
"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": [
|
|
|
|
{
|
|
|
|
"pattern": "@bitwarden/**",
|
|
|
|
"group": "external",
|
|
|
|
"position": "after"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"pattern": "src/**/*",
|
|
|
|
"group": "parent",
|
|
|
|
"position": "before"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"pathGroupsExcludedImportTypes": ["builtin"]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"rxjs-angular/prefer-takeuntil": "error",
|
|
|
|
"rxjs/no-exposed-subjects": ["error", { "allowProtected": true }],
|
|
|
|
"no-restricted-syntax": [
|
|
|
|
"error",
|
2022-09-27 03:17:43 +02:00
|
|
|
{
|
2023-01-31 18:39:10 +01:00
|
|
|
"message": "Calling `svgIcon` directly is not allowed",
|
|
|
|
"selector": "CallExpression[callee.name='svgIcon']"
|
2022-09-27 03:17:43 +02:00
|
|
|
},
|
|
|
|
{
|
2023-01-31 18:39:10 +01:00
|
|
|
"message": "Accessing FormGroup using `get` is not allowed, use `.value` instead",
|
|
|
|
"selector": "ChainExpression[expression.object.callee.property.name='get'][expression.property.name='value']"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"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": [
|
|
|
|
{
|
2023-06-13 02:03:32 +02:00
|
|
|
// avoid specific frameworks or large dependencies in common
|
2023-01-31 18:39:10 +01:00
|
|
|
"target": "./libs/common/**/*",
|
2023-06-13 02:03:32 +02:00
|
|
|
"from": [
|
|
|
|
// Angular
|
|
|
|
"./libs/angular/**/*",
|
|
|
|
"./node_modules/@angular*/**/*",
|
|
|
|
|
|
|
|
// Node
|
|
|
|
"./libs/node/**/*",
|
|
|
|
|
|
|
|
// Import/export
|
|
|
|
"./libs/importer/**/*",
|
|
|
|
"./libs/exporter/**/*"
|
|
|
|
]
|
2023-01-31 18:39:10 +01:00
|
|
|
}
|
|
|
|
]
|
2022-09-27 03:17:43 +02:00
|
|
|
}
|
2023-01-31 18:39:10 +01:00
|
|
|
],
|
|
|
|
"no-restricted-imports": [
|
|
|
|
"error",
|
|
|
|
{ "patterns": ["src/**/*"], "paths": ["@fluffy-spoon/substitute"] }
|
2022-09-27 03:17:43 +02:00
|
|
|
]
|
|
|
|
}
|
2023-01-31 18:39:10 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"files": ["*.html"],
|
|
|
|
"parser": "@angular-eslint/template-parser",
|
2023-02-02 22:27:08 +01:00
|
|
|
"plugins": ["@angular-eslint/template", "tailwindcss"],
|
2023-01-31 18:39:10 +01:00
|
|
|
"rules": {
|
2023-02-02 22:27:08 +01:00
|
|
|
"@angular-eslint/template/button-has-type": "error",
|
|
|
|
"tailwindcss/no-custom-classname": [
|
|
|
|
"error",
|
|
|
|
{
|
|
|
|
// uses negative lookahead to whitelist any class that doesn't start with "tw-"
|
|
|
|
// in other words: classnames that start with tw- must be valid TailwindCSS classes
|
|
|
|
"whitelist": ["(?!(tw)\\-).*"]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"tailwindcss/enforces-negative-arbitrary-values": "error",
|
|
|
|
"tailwindcss/enforces-shorthand": "error",
|
|
|
|
"tailwindcss/no-contradicting-classname": "error"
|
2023-01-31 18:39:10 +01:00
|
|
|
}
|
|
|
|
},
|
2022-09-29 16:38:50 +02:00
|
|
|
{
|
2023-08-08 15:37:25 +02:00
|
|
|
"files": ["libs/angular/src/**/*.ts"],
|
2022-09-29 16:38:50 +02:00
|
|
|
"rules": {
|
2023-08-08 15:37:25 +02:00
|
|
|
"no-restricted-imports": ["error", { "patterns": ["@bitwarden/angular/*", "src/**/*"] }]
|
2022-09-29 16:38:50 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
2023-08-08 15:37:25 +02:00
|
|
|
"files": ["libs/auth/src/**/*.ts"],
|
2022-09-29 16:38:50 +02:00
|
|
|
"rules": {
|
2023-08-08 15:37:25 +02:00
|
|
|
"no-restricted-imports": ["error", { "patterns": ["@bitwarden/auth/*", "src/**/*"] }]
|
2022-09-29 16:38:50 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
2023-08-08 15:37:25 +02:00
|
|
|
"files": ["libs/common/src/**/*.ts"],
|
2022-09-29 16:38:50 +02:00
|
|
|
"rules": {
|
2023-08-08 15:37:25 +02:00
|
|
|
"no-restricted-imports": ["error", { "patterns": ["@bitwarden/common/*", "src/**/*"] }]
|
2022-09-29 16:38:50 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
2023-08-08 15:37:25 +02:00
|
|
|
"files": ["libs/components/src/**/*.ts"],
|
2022-09-29 16:38:50 +02:00
|
|
|
"rules": {
|
2023-08-16 14:26:56 +02:00
|
|
|
"no-restricted-imports": [
|
|
|
|
"error",
|
|
|
|
{ "patterns": ["@bitwarden/components/*", "src/**/*", "@bitwarden/angular/*"] }
|
|
|
|
]
|
2023-08-08 15:37:25 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"files": ["libs/exporter/src/**/*.ts"],
|
|
|
|
"rules": {
|
|
|
|
"no-restricted-imports": ["error", { "patterns": ["@bitwarden/exporter/*", "src/**/*"] }]
|
2022-09-29 16:38:50 +02:00
|
|
|
}
|
2023-03-23 11:43:27 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"files": ["libs/importer/src/**/*.ts"],
|
|
|
|
"rules": {
|
|
|
|
"no-restricted-imports": ["error", { "patterns": ["@bitwarden/importer/*", "src/**/*"] }]
|
|
|
|
}
|
2023-04-19 11:30:46 +02:00
|
|
|
},
|
|
|
|
{
|
2023-08-08 15:37:25 +02:00
|
|
|
"files": ["libs/node/src/**/*.ts"],
|
2023-04-19 11:30:46 +02:00
|
|
|
"rules": {
|
2023-08-08 15:37:25 +02:00
|
|
|
"no-restricted-imports": ["error", { "patterns": ["@bitwarden/node/*", "src/**/*"] }]
|
2023-04-19 11:30:46 +02:00
|
|
|
}
|
2023-08-22 16:02:48 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"files": ["libs/vault/src/**/*.ts"],
|
|
|
|
"rules": {
|
|
|
|
"no-restricted-imports": ["error", { "patterns": ["@bitwarden/vault/*", "src/**/*"] }]
|
|
|
|
}
|
2022-09-29 16:38:50 +02:00
|
|
|
}
|
|
|
|
]
|
2022-05-03 21:45:37 +02:00
|
|
|
}
|