Why does @nx/angular:library generator produce eslint config files that override base config rules? #32654
Replies: 1 comment 1 reply
-
I've had this question pop up internally also so i'll chime in. I think from the nx side it makes sense to not have the angular specific eslint configs in the root eslint config. Remember that nx is not for angular only and you'll run into monorepos that have both angular and react or other frameworks. That would mean the root config has to include lint configs for all of the provided frameworks and I assume, (not entirely sure here), that could cause clashes. And also just the fact that it makes no sense to run angular eslint rules in a react lib. I think that is why each lib has to have those configs, - although it does look very counter-intuitive. Maybe having several "root" level configs per lib type (so |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
@nx/angular:library generator produces eslint configs that first extend the baseConfig but then extend other sets of rules, in case of flat config the order is
Meaning that by default angular-eslint rules will take precedence over whatever the user wants and has set in their base config.
There has been a related issue for it, #5259, but it's been closed as fixed, I guess because technically the issue asked for NX to override fewer rules, which it does now, but it still overrides some, which to me implies that this behaviour is intentional.
What's the rationale behind overriding the base config rules like that? There are way too many eslint config files in an average nx monorepo, so it makes sense to set the majority of the rules in the base config and then only make the necessary lib-specific changes in the lib-level configs (like component prefixes), so I feel like this default behaviour is highly counter-intuitive.
Beta Was this translation helpful? Give feedback.
All reactions