Comments (9)
In my example I am wrapping a Promise?
protected slowAction$ = defer(() => from(YOUR_PROMISE_HERE));
from angular-eslint.
Why are you using a function which returns the Observable, instead of working with the Observable directly? With your pattern, for each change detection cycle, a new Observable will be created. Sounds like an antipattern to me.
from angular-eslint.
I changed the example above and added parts of the directive's implementation. Its a function returning a function that returns an Observable/Promise. The function only gets called when clicking on the host element (<my-custom-component/>
). That's the reason why I chose this weird construct.
from angular-eslint.
@maxfriedmann it might be helpful if you could share a minimal end to end example in a stackblitz?
from angular-eslint.
@JamesHenry sure: https://stackblitz.com/edit/angular-kxrwgv
from angular-eslint.
@maxfriedmann I think using an Observable using rxjs's defer
would be preferable here:
https://stackblitz.com/edit/angular-rju8dt?file=src%2Fmain.ts
from angular-eslint.
Thank you for taking the time. You're right, unfortunately this would require a massive migration in our source (around ~2300 places where [loadingFn] is currently used).
And, more important, that would not work with promises.
from angular-eslint.
Okay, I'll give this a try. Thank you for your time!
from angular-eslint.
Cool hope that's useful! For changes that don't make sense for everyone that uses angular-eslint, it's always possible to build your own lint rules using @angular-eslint/utils
so that it also something you can explore if you want to enforce particular unique usage
from angular-eslint.
Related Issues (20)
- [eqeqeq] Incorrectly updates the template when run with '--fix' option HOT 6
- [@angular-eslint/schematics] --skip-confirmation parameter does not works HOT 1
- ES Lint not working with Angular 16 HOT 4
- Update the list of native event names
- [no-call-expression] False negative with the new control flow syntax HOT 2
- [prefer-self-closing-tags] closes ng-container with
- [@angular-eslint/template/no-any] does not throw error for property binding with square bracket notation
- [prefer-self-closing-tags] autofix removes comment between element tags
- [alt-text] input element with all types should have check HOT 2
- [prefer-readonly-signals] New rule for checking that signals are defined as readonly
- [consistent-type-imports] new rule request
- [developer-preview] New rule to avoid dev preview HOT 1
- latest 16.x @angular-eslint/builder incompatible with eslint 8.56: "Unknown options: reportUnusedDisableDirectives" HOT 2
- [no-input-rename] support signal input/model
- [attributes-order] Fixer mangles code when valueless structural directives are present in final position. HOT 4
- [@typescript-eslint/array-type] Definition for rule '@typescript-eslint/array-type' was not found HOT 3
- Error: The `convert-tslint-to-eslint` schematic is no longer supported. HOT 3
- [attributes-order] angular input binding without brackets considered as attribute binding HOT 1
- [no-attributes-combination] new rule request
- [@angular-eslint/template/attributes-order] doc is missing the info what is default for `alphabetical` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-eslint.