From 1b609d8d7d86107567988d7c0ccc21d5f4a1c179 Mon Sep 17 00:00:00 2001 From: Hallison Date: Fri, 23 Jun 2023 09:56:14 -0300 Subject: [PATCH 1/3] chore: dependency rules and tags --- .eslintrc.json | 39 +++++++++++++++++++++++++++++++++-- libs/data-access/project.json | 22 ++++++++++++++------ libs/domain/project.json | 22 ++++++++++++++------ libs/feature/project.json | 19 ++++++++++++----- libs/util-core/project.json | 22 ++++++++++++++------ 5 files changed, 99 insertions(+), 25 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 0be733b..8321fdf 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -13,8 +13,43 @@ "allow": [], "depConstraints": [ { - "sourceTag": "*", - "onlyDependOnLibsWithTags": ["*"] + "sourceTag": "type:data-access", + "onlyDependOnLibsWithTags": ["type:util", "type:data-access"] + }, + { + "sourceTag": "type:shell", + "onlyDependOnLibsWithTags": [ + "type:feature", + "type:data-access, type:ui, type:util" + ] + }, + { + "sourceTag": "scope:product", + "onlyDependOnLibsWithTags": ["scope:shared", "scope:product"] + }, + { + "sourceTag": "type:feature", + "onlyDependOnLibsWithTags": [ + "type:util", + "type:ui", + "type:data-access" + ] + }, + { + "sourceTag": "type:domain", + "onlyDependOnLibsWithTags": ["type:util", "type:api"] + }, + { + "sourceTag": "type:ui", + "onlyDependOnLibsWithTags": ["type:util", "type:ui"] + }, + { + "sourceTag": "type:util", + "onlyDependOnLibsWithTags": ["scope:util"] + }, + { + "sourceTag": "type:api", + "onlyDependOnLibsWithTags": ["scope:api"] } ] } diff --git a/libs/data-access/project.json b/libs/data-access/project.json index 15bc568..a83e993 100644 --- a/libs/data-access/project.json +++ b/libs/data-access/project.json @@ -6,7 +6,9 @@ "targets": { "build": { "executor": "@nx/js:tsc", - "outputs": ["{options.outputPath}"], + "outputs": [ + "{options.outputPath}" + ], "options": { "outputPath": "dist/libs/data-access", "main": "libs/data-access/src/index.ts", @@ -16,14 +18,20 @@ }, "lint": { "executor": "@nx/linter:eslint", - "outputs": ["{options.outputFile}"], + "outputs": [ + "{options.outputFile}" + ], "options": { - "lintFilePatterns": ["libs/data-access/**/*.ts"] + "lintFilePatterns": [ + "libs/data-access/**/*.ts" + ] } }, "test": { "executor": "@nx/jest:jest", - "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], + "outputs": [ + "{workspaceRoot}/coverage/{projectRoot}" + ], "options": { "jestConfig": "libs/data-access/jest.config.ts", "passWithNoTests": true @@ -36,5 +44,7 @@ } } }, - "tags": [] -} + "tags": [ + "type:data-access" + ] +} \ No newline at end of file diff --git a/libs/domain/project.json b/libs/domain/project.json index 77690de..49cbef8 100644 --- a/libs/domain/project.json +++ b/libs/domain/project.json @@ -6,7 +6,9 @@ "targets": { "build": { "executor": "@nx/js:tsc", - "outputs": ["{options.outputPath}"], + "outputs": [ + "{options.outputPath}" + ], "options": { "outputPath": "dist/libs/domain", "main": "libs/domain/src/index.ts", @@ -16,14 +18,20 @@ }, "lint": { "executor": "@nx/linter:eslint", - "outputs": ["{options.outputFile}"], + "outputs": [ + "{options.outputFile}" + ], "options": { - "lintFilePatterns": ["libs/domain/**/*.ts"] + "lintFilePatterns": [ + "libs/domain/**/*.ts" + ] } }, "test": { "executor": "@nx/jest:jest", - "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], + "outputs": [ + "{workspaceRoot}/coverage/{projectRoot}" + ], "options": { "jestConfig": "libs/domain/jest.config.ts", "passWithNoTests": true @@ -36,5 +44,7 @@ } } }, - "tags": [] -} + "tags": [ + "type:domain" + ] +} \ No newline at end of file diff --git a/libs/feature/project.json b/libs/feature/project.json index 93c9611..502c9f0 100644 --- a/libs/feature/project.json +++ b/libs/feature/project.json @@ -3,12 +3,16 @@ "$schema": "../../node_modules/nx/schemas/project-schema.json", "sourceRoot": "libs/feature/src", "prefix": "getlab", - "tags": ["type:feature"], + "tags": [ + "type:feature" + ], "projectType": "library", "targets": { "test": { "executor": "@nx/jest:jest", - "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], + "outputs": [ + "{workspaceRoot}/coverage/{projectRoot}" + ], "options": { "jestConfig": "libs/feature/jest.config.ts", "passWithNoTests": true @@ -22,10 +26,15 @@ }, "lint": { "executor": "@nx/linter:eslint", - "outputs": ["{options.outputFile}"], + "outputs": [ + "{options.outputFile}" + ], "options": { - "lintFilePatterns": ["libs/feature/**/*.ts", "libs/feature/**/*.html"] + "lintFilePatterns": [ + "libs/feature/**/*.ts", + "libs/feature/**/*.html" + ] } } } -} +} \ No newline at end of file diff --git a/libs/util-core/project.json b/libs/util-core/project.json index b58f8bd..cdc0354 100644 --- a/libs/util-core/project.json +++ b/libs/util-core/project.json @@ -6,7 +6,9 @@ "targets": { "build": { "executor": "@nx/js:tsc", - "outputs": ["{options.outputPath}"], + "outputs": [ + "{options.outputPath}" + ], "options": { "outputPath": "dist/libs/util-core", "main": "libs/util-core/src/index.ts", @@ -16,14 +18,20 @@ }, "lint": { "executor": "@nx/linter:eslint", - "outputs": ["{options.outputFile}"], + "outputs": [ + "{options.outputFile}" + ], "options": { - "lintFilePatterns": ["libs/util-core/**/*.ts"] + "lintFilePatterns": [ + "libs/util-core/**/*.ts" + ] } }, "test": { "executor": "@nx/jest:jest", - "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], + "outputs": [ + "{workspaceRoot}/coverage/{projectRoot}" + ], "options": { "jestConfig": "libs/util-core/jest.config.ts", "passWithNoTests": true @@ -36,5 +44,7 @@ } } }, - "tags": [] -} + "tags": [ + "type:util" + ] +} \ No newline at end of file From bd348522e7bee73ed3e3b531829122061c8470a2 Mon Sep 17 00:00:00 2001 From: Hallison Date: Fri, 23 Jun 2023 10:12:00 -0300 Subject: [PATCH 2/3] style: cleanup format --- libs/data-access/project.json | 22 ++++++---------------- libs/domain/project.json | 22 ++++++---------------- libs/feature/project.json | 19 +++++-------------- libs/util-core/project.json | 22 ++++++---------------- 4 files changed, 23 insertions(+), 62 deletions(-) diff --git a/libs/data-access/project.json b/libs/data-access/project.json index a83e993..1900c07 100644 --- a/libs/data-access/project.json +++ b/libs/data-access/project.json @@ -6,9 +6,7 @@ "targets": { "build": { "executor": "@nx/js:tsc", - "outputs": [ - "{options.outputPath}" - ], + "outputs": ["{options.outputPath}"], "options": { "outputPath": "dist/libs/data-access", "main": "libs/data-access/src/index.ts", @@ -18,20 +16,14 @@ }, "lint": { "executor": "@nx/linter:eslint", - "outputs": [ - "{options.outputFile}" - ], + "outputs": ["{options.outputFile}"], "options": { - "lintFilePatterns": [ - "libs/data-access/**/*.ts" - ] + "lintFilePatterns": ["libs/data-access/**/*.ts"] } }, "test": { "executor": "@nx/jest:jest", - "outputs": [ - "{workspaceRoot}/coverage/{projectRoot}" - ], + "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], "options": { "jestConfig": "libs/data-access/jest.config.ts", "passWithNoTests": true @@ -44,7 +36,5 @@ } } }, - "tags": [ - "type:data-access" - ] -} \ No newline at end of file + "tags": ["type:data-access"] +} diff --git a/libs/domain/project.json b/libs/domain/project.json index 49cbef8..9ff0926 100644 --- a/libs/domain/project.json +++ b/libs/domain/project.json @@ -6,9 +6,7 @@ "targets": { "build": { "executor": "@nx/js:tsc", - "outputs": [ - "{options.outputPath}" - ], + "outputs": ["{options.outputPath}"], "options": { "outputPath": "dist/libs/domain", "main": "libs/domain/src/index.ts", @@ -18,20 +16,14 @@ }, "lint": { "executor": "@nx/linter:eslint", - "outputs": [ - "{options.outputFile}" - ], + "outputs": ["{options.outputFile}"], "options": { - "lintFilePatterns": [ - "libs/domain/**/*.ts" - ] + "lintFilePatterns": ["libs/domain/**/*.ts"] } }, "test": { "executor": "@nx/jest:jest", - "outputs": [ - "{workspaceRoot}/coverage/{projectRoot}" - ], + "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], "options": { "jestConfig": "libs/domain/jest.config.ts", "passWithNoTests": true @@ -44,7 +36,5 @@ } } }, - "tags": [ - "type:domain" - ] -} \ No newline at end of file + "tags": ["type:domain"] +} diff --git a/libs/feature/project.json b/libs/feature/project.json index 502c9f0..93c9611 100644 --- a/libs/feature/project.json +++ b/libs/feature/project.json @@ -3,16 +3,12 @@ "$schema": "../../node_modules/nx/schemas/project-schema.json", "sourceRoot": "libs/feature/src", "prefix": "getlab", - "tags": [ - "type:feature" - ], + "tags": ["type:feature"], "projectType": "library", "targets": { "test": { "executor": "@nx/jest:jest", - "outputs": [ - "{workspaceRoot}/coverage/{projectRoot}" - ], + "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], "options": { "jestConfig": "libs/feature/jest.config.ts", "passWithNoTests": true @@ -26,15 +22,10 @@ }, "lint": { "executor": "@nx/linter:eslint", - "outputs": [ - "{options.outputFile}" - ], + "outputs": ["{options.outputFile}"], "options": { - "lintFilePatterns": [ - "libs/feature/**/*.ts", - "libs/feature/**/*.html" - ] + "lintFilePatterns": ["libs/feature/**/*.ts", "libs/feature/**/*.html"] } } } -} \ No newline at end of file +} diff --git a/libs/util-core/project.json b/libs/util-core/project.json index cdc0354..8e5541d 100644 --- a/libs/util-core/project.json +++ b/libs/util-core/project.json @@ -6,9 +6,7 @@ "targets": { "build": { "executor": "@nx/js:tsc", - "outputs": [ - "{options.outputPath}" - ], + "outputs": ["{options.outputPath}"], "options": { "outputPath": "dist/libs/util-core", "main": "libs/util-core/src/index.ts", @@ -18,20 +16,14 @@ }, "lint": { "executor": "@nx/linter:eslint", - "outputs": [ - "{options.outputFile}" - ], + "outputs": ["{options.outputFile}"], "options": { - "lintFilePatterns": [ - "libs/util-core/**/*.ts" - ] + "lintFilePatterns": ["libs/util-core/**/*.ts"] } }, "test": { "executor": "@nx/jest:jest", - "outputs": [ - "{workspaceRoot}/coverage/{projectRoot}" - ], + "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], "options": { "jestConfig": "libs/util-core/jest.config.ts", "passWithNoTests": true @@ -44,7 +36,5 @@ } } }, - "tags": [ - "type:util" - ] -} \ No newline at end of file + "tags": ["type:util"] +} From 8bbdfd61798fd9f967d9c6fbc6c1e7c3f6004d97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hallison=20Brancalh=C3=A3o?= Date: Fri, 23 Jun 2023 23:10:46 -0300 Subject: [PATCH 3/3] chore(getlab): lint rules deps constraints --- .eslintrc.json | 6 +++++- apps/getlab/project.json | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 8321fdf..d617122 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -12,9 +12,13 @@ "enforceBuildableLibDependency": true, "allow": [], "depConstraints": [ + { + "sourceTag": "type:app", + "onlyDependOnLibsWithTags": ["type:feature", "type:data-access"] + }, { "sourceTag": "type:data-access", - "onlyDependOnLibsWithTags": ["type:util", "type:data-access"] + "onlyDependOnLibsWithTags": ["type:util", "type:domain"] }, { "sourceTag": "type:shell", diff --git a/apps/getlab/project.json b/apps/getlab/project.json index ac0284a..c064273 100644 --- a/apps/getlab/project.json +++ b/apps/getlab/project.json @@ -4,7 +4,7 @@ "projectType": "application", "prefix": "getlab", "sourceRoot": "apps/getlab/src", - "tags": [], + "tags": ["type:app"], "targets": { "build": { "executor": "@angular-devkit/build-angular:browser",