Currently when affected is executed it runs all targets on whole affected tree, which makes 100% sense for:
those afformentioned targets are real safe-guards in terms of not breaking API/application
Now for lint on the other hand, we know it's not necessary ( for our monorepo project 5k + modules ).
What we can say with confidence, is, that for our use case, it would make sense, to run linter only on touched files per project in particular affected tree, thus rapidly speeding up linting process on CI.
NOTE:
you might be thinking, there is thiscacheoption, provided by native eslint
--->
well in short, that doesn't work properly, especially on CI
Edge cases:
let's say we have this simple dep graph
// lib A uses lib B
[ lib A ] ---> [ lib B ]
@typescript-eslint/no-unsafe- family and they are set to severity: error, and owner of libB changes api to return any ( which is a type information breaking change, which could be possibly catched by TypeScript anyways ), then consumer of libB (libA) would contain invalid code from linter perspective, thus introduce error to other developers after it was mergedI'd add new option flag to current builder, to support this behaviour as an opt-in feature, which would not introduce breaking changes.
"lint": {
"builder": "@nrwl/linter:lint",
"options": {
"linter": "eslint",
"config": "path/to/lib/.eslintrc",
"tsConfig": [
"path/to/lib/tsconfig.lib.json",
"path/to/lib/tsconfig.spec.json"
],
"exclude": ["**/node_modules/**"],
+ "touchedOnly": true
}
}
with that touchedOnly could just extract touched files internaly and provide those to already supported --files flag
@JamesHenry 馃憢 . You might want to chime in here as well 馃槃
Having the same issue. I would same the same applies to format:check and format:write... I would even go further and say that, for the format, it doesn't even depend on the graph, as there is only one .prettierrc for all apps/libs. So, a simple diff of files between base and head should do it right?
@cafesanu I'll soon release lint builder with this functionality :)
Nice! is this part of the new eslint builder in 10.3.0?
Nice! is this part of the new eslint builder in
10.3.0?
Nope, my implementation covering this proposal - we use it at work already :)
Wow this would be a great feature to have! I just tried to wrap my head around the fact, that linting is really not dependent on the affected graph, but rather on the files that were touched :thinking:
Thanks for implementing this :raised_hands:
Most helpful comment
@cafesanu I'll soon release lint builder with this functionality :)