eslint-config-brf
Version:
brf lint custom configurations
259 lines (258 loc) • 8.3 kB
JavaScript
module.exports = {
overrides: [
{
plugins: ["@typescript-eslint", "boundaries"],
extends: ["plugin:boundaries/recommended"],
files: ["projects/application/src/app/**/*.ts"],
settings: {
"import/resolver": {
typescript: {
alwaysTryTypes: true,
},
},
"boundaries/ignore": [
"**/*.spec.ts",
"projects/application/src/app/application/language/locale/**",
"projects/application/src/app/environment/environment?(.(dev|hml|prod)).ts",
],
"boundaries/elements": [
{
type: "contracts",
pattern:
"projects/application/src/app/application/*/contract/(request/+([a-z0-9-]).request|response/?(*/)+([a-z0-9-]).response).ts",
mode: "file",
capture: ["product", "type", "name"],
},
{
type: "facades",
pattern:
"projects/application/src/app/application/*/abstraction/?(*/)+([a-z0-9-])-facade.service.ts",
mode: "file",
capture: ["product", "name"],
},
{
type: "infrastructure-services",
pattern:
"projects/application/src/app/infrastructure/*/service/?(*/)+([a-z0-9-]).service.ts",
mode: "file",
capture: ["product", "name"],
},
{
type: "domain-types",
pattern:
"projects/application/src/app/domain/*/(enum/?(*/)+([a-z0-9-]).enum|type/?(*/)+([a-z0-9-]).type|interface/?(*/)+([a-z0-9-]).interface|model/?(*/)+([a-z0-9-])).ts",
mode: "file",
capture: ["product", "name"],
},
{
type: "components",
pattern:
"projects/application/src/app/infrastructure/*/presentation/**/+([a-z0-9-]).component.ts",
mode: "file",
capture: ["product"],
},
{
type: "components-test",
pattern:
"projects/application/src/app/infrastructure/*/presentation/**/+([a-z0-9-]).component.spec.ts",
mode: "file",
capture: ["product"],
},
{
type: "mocks",
pattern:
"projects/application/src/app/infrastructure/*/mock/+([a-z0-9-]).mock.json",
mode: "file",
capture: ["product", "name"],
},
{
type: "modules",
pattern:
"projects/application/src/app/(shared/|infrastructure/(shared/pipe/|*/?(presentation/**/)))+([a-z0-9-]).module.ts",
mode: "file",
capture: ["product"],
},
{
type: "shared-services",
pattern:
"projects/application/src/app/infrastructure/shared/presentation/**/+([a-z0-9-]).service.ts",
mode: "file",
},
{
type: "utils",
pattern:
"projects/application/src/app/infrastructure/shared/util/+([a-z0-9-]).util.ts",
mode: "file",
},
{
type: "pipes",
pattern:
"projects/application/src/app/infrastructure/shared/pipe/+([a-z0-9-]).pipe.ts",
mode: "file",
},
{
type: "validators",
pattern:
"projects/application/src/app/infrastructure/shared/validator/+([a-z0-9-]).validator.ts",
mode: "file",
},
{
type: "directives",
pattern:
"projects/application/src/app/infrastructure/shared/directive/+([a-z0-9-]).directive.ts",
mode: "file",
},
{
type: "domain-routes",
pattern:
"projects/application/src/app/infrastructure/domain.routes.ts",
mode: "file",
},
{
type: "constants",
pattern: "projects/application/src/app/application/constants.ts",
mode: "file",
},
{
type: "resolvers",
pattern:
"projects/application/src/app/application/*/resolver/+([a-z0-9-]).resolver.ts",
mode: "file",
capture: ["product", "name"],
},
{
type: "interceptors",
pattern:
"projects/application/src/app/application/*/interceptor/+([a-z0-9-]).interceptor.ts",
mode: "file",
capture: ["product", "name"],
},
{
type: "guards",
pattern:
"projects/application/src/app/application/*/guard/+([a-z0-9-]).guard.ts",
mode: "file",
capture: ["product", "name"],
},
],
},
rules: {
"import/order": ["off"],
"boundaries/no-unknown-files": ["error"],
"boundaries/element-types": [
"error",
{
default: "disallow",
message: "${file.type} is not allowed to import ${dependency.type}",
rules: [
{
from: [
"contracts",
"facades",
"infrastructure-services",
"domain-types",
"components",
"shared-services",
"utils",
"pipes",
"guards",
"resolvers",
"validators",
"directives",
"interceptors",
],
allow: ["utils", "constants", "domain-types"],
},
{
from: [
"contracts",
"facades",
"infrastructure-services",
"domain-types",
"components",
"shared-services",
"modules",
],
allow: "pipes",
},
{
from: "infrastructure-services",
allow: ["contracts", "infrastructure-services"],
},
{
from: "facades",
allow: ["infrastructure-services"],
},
{
from: "modules",
allow: [
"components",
"facades",
"constants",
"modules",
"shared-services",
"infrastructure-services",
"domain-types",
"guards",
"resolvers",
"interceptors",
"validators",
"directives",
],
},
{
from: "components",
allow: [
"components",
"facades",
"shared-services",
"validators",
"directives",
],
},
{
from: "components-test",
allow: [
"components",
"facades",
"shared-services",
"validators",
"directives",
"mock",
],
},
{
from: "shared-services",
allow: ["components"],
},
{
from: "domain-routes",
allow: ["constants", "domain-types", "guards", "resolvers"],
},
{
from: "guards",
allow: ["facades", "shared-services"],
},
{
from: "resolvers",
allow: ["facades", "shared-services"],
},
{
from: "validators",
allow: ["facades", "shared-services"],
},
{
from: "directives",
allow: ["facades", "shared-services", "validators"],
},
{
from: "interceptors",
allow: ["contracts"],
},
],
},
],
},
},
],
};