Skip to content

Commit 16a3977

Browse files
committed
refactor: use plugin to set up targets
1 parent ccdb58d commit 16a3977

3 files changed

Lines changed: 55 additions & 129 deletions

File tree

nx.json

Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,32 @@
4949
}
5050
],
5151
"sharedGlobals": [
52-
{ "runtime": "node -e \"console.log(require('os').platform())\"" },
53-
{ "runtime": "node -v" },
54-
{ "runtime": "npm -v" }
52+
{
53+
"runtime": "node -e \"console.log(require('os').platform())\""
54+
},
55+
{
56+
"runtime": "node -v"
57+
},
58+
{
59+
"runtime": "npm -v"
60+
}
5561
]
5662
},
5763
"targetDefaults": {
64+
"lint": {
65+
"dependsOn": ["eslint-formatter-multi:build"],
66+
"inputs": ["lint-eslint-inputs"],
67+
"outputs": ["{projectRoot}/.eslint/**/*"],
68+
"cache": true,
69+
"options": {
70+
"max-warnings": 0,
71+
"error-on-unmatched-pattern": false,
72+
"//": "replace the formatter path with the released package @code-pushup/eslint-formatter-multi when available",
73+
"//": "this will make the formatter resolve in any target.",
74+
"format": "./tools/eslint-formatter-multi/dist/src/index.js",
75+
"cwd": "{workspaceRoot}"
76+
}
77+
},
5878
"build": {
5979
"dependsOn": ["^build"],
6080
"inputs": ["production", "^production"],
@@ -95,31 +115,6 @@
95115
"inputs": ["default"],
96116
"cache": true
97117
},
98-
"lint": {
99-
"inputs": ["lint-eslint-inputs"],
100-
"executor": "@nx/eslint:lint",
101-
"cache": true,
102-
"options": {
103-
"errorOnUnmatchedPattern": false,
104-
"maxWarnings": 0,
105-
"lintFilePatterns": [
106-
"{projectRoot}/**/*.ts",
107-
"{projectRoot}/package.json"
108-
]
109-
}
110-
},
111-
"lint-report": {
112-
"dependsOn": ["eslint-formatter-multi:build"],
113-
"inputs": ["lint-eslint-inputs"],
114-
"outputs": ["{projectRoot}/.eslint"],
115-
"executor": "nx:run-commands",
116-
"options": {
117-
"command": "nx run {projectName}:lint --format=./tools/eslint-formatter-multi/dist/src/index.js",
118-
"env": {
119-
"ESLINT_FORMATTER_CONFIG": "{\"outputDir\":\"{projectRoot}/.eslint\"}"
120-
}
121-
}
122-
},
123118
"nxv-pkg-install": {
124119
"parallelism": false
125120
},
@@ -330,6 +325,12 @@
330325
"releaseTagPattern": "v{version}"
331326
},
332327
"plugins": [
328+
{
329+
"plugin": "@nx/eslint/plugin",
330+
"options": {
331+
"targetName": "lint"
332+
}
333+
},
333334
{
334335
"plugin": "@push-based/nx-verdaccio",
335336
"options": {
@@ -344,6 +345,12 @@
344345
"filterByTags": ["publishable"]
345346
}
346347
}
348+
},
349+
{
350+
"plugin": "@nx/eslint/plugin",
351+
"options": {
352+
"targetName": "lint"
353+
}
347354
}
348355
],
349356
"nxCloudId": "65d4d862d2adb16a45a4bc7c"

package-lock.json

Lines changed: 18 additions & 100 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@
5757
"@commitlint/cz-commitlint": "^19.5.0",
5858
"@commitlint/types": "^19.5.0",
5959
"@nodelib/fs.walk": "^2.0.0",
60-
"@nx/eslint-plugin": "21.4.1",
60+
"@nx/eslint": "^21.4.1",
61+
"@nx/eslint-plugin": "^21.4.1",
6162
"@nx/js": "21.4.1",
6263
"@nx/plugin": "21.4.1",
6364
"@nx/react": "21.4.1",

0 commit comments

Comments
 (0)