Skip to content

Commit

Permalink
refactor: add nx dependency check eslint rule
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasvieirasilva committed Dec 20, 2023
1 parent c3ab930 commit 5f8b38f
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 22 deletions.
3 changes: 2 additions & 1 deletion packages/data-migration/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"files": ["./package.json", "./generators.json", "./executors.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"@nx/nx-plugin-checks": "error"
"@nx/nx-plugin-checks": "error",
"@nx/dependency-checks": "error"
}
}
]
Expand Down
24 changes: 23 additions & 1 deletion packages/data-migration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,28 @@
"access": "public"
},
"dependencies": {
"tslib": "^2.3.0"
"tslib": "^2.3.0",
"@nx/devkit": "17.2.6",
"@nx/js": "17.2.6",
"@nxlv/util": "*",
"glob": "^10.2.6",
"@aws-sdk/client-dynamodb": "^3.348.0",
"@aws-sdk/client-dynamodb-streams": "^3.348.0",
"@aws-sdk/client-lambda": "^3.348.0",
"@aws-sdk/client-iam": "^3.348.0",
"@aws-sdk/client-ssm": "^3.348.0",
"aws-sdk-client-mock-jest": "^2.1.1",
"aws-sdk-client-mock": "^2.1.1",
"esbuild": "0.19.10",
"archiver": "^5.3.1",
"lodash": "4.17.21",
"chalk": "^4.1.1",
"@aws-sdk/client-ecs": "^3.348.0",
"dynamoose": "^3.2.0",
"@aws-sdk/client-sts": "^3.348.0",
"@aws-sdk/client-ecr": "^3.348.0",
"@aws-sdk/client-cloudwatch-logs": "^3.348.0",
"cross-spawn": "^7.0.3",
"prompts": "^2.4.2"
}
}
3 changes: 2 additions & 1 deletion packages/nx-python/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
],
"parser": "jsonc-eslint-parser",
"rules": {
"@nx/nx-plugin-checks": "error"
"@nx/nx-plugin-checks": "error",
"@nx/dependency-checks": "error"
}
}
]
Expand Down
18 changes: 1 addition & 17 deletions packages/nx-python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,6 @@ The `derived` option uses the combination of the workspace layout, `--directory`
Example 1: `nx generate @nxlv/python:poetry-project myproject` will generate the project in the `apps/myproject` folder with the name `myproject`.
Example 2: `nx generate @nxlv/python:poetry-project myproject --directory=api` will generate the project in the `apps/api/myproject` folder with the name `api-myproject`.

**NOTE**: The `derived` option is the default option for now, however, the `as-provided` option will be the default option in the future.

To make the `as-provided` option the default option, add the following configuration in the `nx.json` file:

```json
{
...
"generators": {
"@nxlv/python:poetry-project": {
"projectNameAndRootFormat": "as-provided"
}
}
...
}
```

Nx documentation reference: <https://nx.dev/deprecated/as-provided-vs-derived#project-generators>

#### Options
Expand All @@ -95,7 +79,7 @@ Nx documentation reference: <https://nx.dev/deprecated/as-provided-vs-derived#pr
| `--codeCoverageHtmlReport` | `boolean` | Enable Code Coverage HTML Reports | `false` | `true` |
| `--codeCoverageXmlReport` | `boolean` | Enable Code Coverage XML Reports | `false` | `true` |
| `--codeCoverageThreshold` | `number` | Minimum Code Coverage Threshold | `false` | N/A |
| `--projectNameAndRootFormat` | `string` | Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`). | `false` | `derived` |
| `--projectNameAndRootFormat` | `string` | Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`). | `false` | `as-provided` |

##### rootPyprojectDependencyGroup

Expand Down
13 changes: 12 additions & 1 deletion packages/nx-python/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,18 @@
"directory": "packages/nx-python"
},
"peerDependencies": {
"@nx/devkit": "^17.0.0"
"@nx/devkit": "^17.0.0",
"chalk": "^4.1.1",
"fs-extra": "^11.1.0",
"@iarna/toml": "^2.2.5",
"mock-fs": "^5.2.0",
"string-dedent": "^3.0.1",
"uuid": "^9.0.0",
"file-uri-to-path": "^2.0.0",
"cross-spawn": "^7.0.3",
"nx": "17.2.6",
"command-exists": "^1.2.9",
"lodash": "4.17.21"
},
"dependencies": {
"tslib": "^2.3.0"
Expand Down
7 changes: 7 additions & 0 deletions packages/util/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@
{
"files": ["*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"@nx/dependency-checks": "error"
}
}
]
}
3 changes: 2 additions & 1 deletion packages/util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"access": "public"
},
"dependencies": {
"tslib": "^2.3.0"
"tslib": "^2.3.0",
"lodash": "4.17.21"
}
}

0 comments on commit 5f8b38f

Please sign in to comment.