EmmanuelDemey / EmmanuelDemey/eslint-plugin-angular
`no-run-logic`: allow arguments to be nested
- Dominant language
- JavaScript
- Stars
- 620
- Forks
- 127
- PR merge metrics
- No merged PRs in 30d
Description
Currently it's not possible to use the rule with the following:
``` js
angular
.module('foo', [
'config',
'someLogicModule',
])
.run(function (
someLogic,
config
) {
someLogic(config.foo.bar.baz);
})
```
Rationale:
In my project I have configuration built from many sources in CD. `config` module is created dynamically. I only allow `run` blocks to import `config` constant but the constant itself is nested (it's created from JSON objects). I chose to expose those things to DI under a common name to prevent naming collisions.
I'm striding towards applying this rule, but this really holds me back: I want to keep the architectural decision of NOT injecting `config` directly to services providing logic. On the other hand the only thing I can do with the rule enabled is:
``` js
.run(function (
someLogic,
config
) {
someLogic(config); // and handle `foo.bar.baz` inside
})
```
which gives `someLogic` too much power.
I suggest there should be a setting that will optionally allow passing values nested in DI objects.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.