question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add rxjs-all-subjects-suffixed rule

See original GitHub issue

I have another rule addition suggestion:

rxjs-all-subjects-suffixed (or rxjs-no-unsuffixed-subjects as per your naming convention), which enforces that subject names must be suffixed with Subject$ (also as per the Finnish notation rule).

e.g.

class Mock {
  private property$ = new Rx.Subject<any>();
          ~~~~~~~~~                   [Subject 'property$' must end with 'Subject$']
}

Let me know if this is also of interest to integrate. 😄

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
cartantcommented, Jan 29, 2019

Yeah. In general, I’m happy to have rules added to the package. They don’t have to conform to my opinions - e.g. I’m not a fan of Finnish notation. My only criteria is that they should do what they’re intended to do in all circumstances - or, at least, with as few exceptions as possible.

When writing your new rule, you might want to have a look at Craig’s tsquery package. I favour it over using a walker and I’ve used to for all of my most recent rules, e.g.:

Search for tsquery( for more examples in this repo.

Craig has written about it here.

1reaction
cartantcommented, Jan 29, 2019

Also, with this one, I think it’ll be important for the suffix to be configurable - i.e. via an option.

And I’d try to keep the rule name as short as possible. Maybe rxjs-suffix-subjects?

Read more comments on GitHub >

github_iconTop Results From Across the Web

rxjs-suffix-subjects throws error in console · Issue #88 - GitHub
When run ng lint, this outputs in console for some files, all subjects have required suffix so at the end it succeed, but...
Read more >
rxjs-tslint-rules
rxjs -suffix-subjects​​ The rule takes an optional object with optional parameters , properties and variables properties. The properties are booleans and ...
Read more >
rxjs-tslint-rules | Yarn - Package Manager
rxjs -no-explicit-generics, Disallows the explicit specification of generic type arguments when calling operators. Rely upon TypeScript's inference instead. None.
Read more >
Create custom RxJs Subject - Stack Overflow
I have a need for a QueueSubject , i.e. a Subject that queues all values passed to its next method until there is...
Read more >
On The Subject Of Subjects (in RxJS) | by Ben Lesh - Medium
Subjects in RxJS aren't much different. When you call subscribe with an observer on an Rx Subject, it will add that observer to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found