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 an option to enforce subscription variable names using finnish rule

See original GitHub issue

First point is that I noticed that the project I’m currently working on has two standards for “Subscription” declarations: one that uses finnish notation and others that don’t, so I’d like to propose the addition of this option in finnish rule.

A trivial case that I’m seeing much is the use with @ngrx / component-store, which generally looks like this:

class MyStore extends ComponentStore<State> {
  // `myEffect` is typed as `Subscription`.
  readonly myEffect = this.effect(trigger$ => trigger$.pipe())
}

In this case, I’d like to enforce myEffect to be myEffect$. Maybe it could be useful to implements it also in no-finnish so other teams can avoid this notation even for Subscription.

The second point is another thing that I also noticed that sometimes the finnish notation is misused, for example in places that do not use Observables or something like that, but I don’t know if it’s in the scope of this rule.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
timdeschryvercommented, Feb 9, 2021

I don’t think this makes sense. A component store effect is just a method that returns a void or a Subscription, the return type of the attached snipped would be const myEffect: () => void.

0reactions
cartantcommented, Feb 13, 2021

In 3.1.0, the finnish rule now has a strict option that will effect failures for non-Observable identifiers that have a $ suffix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Rule for Finnish Notation in Observables names #24 - GitHub
Well, I'm personally not a fan. And that article states that the: idea here is that you pluralize all variable names that contain...
Read more >
rxjs-tslint-rules
The rxjs-finnish rule takes an optional object with optional functions , methods , parameters , properties and variables properties. The properties are booleans ......
Read more >
Observables and Finnish Notation - Ben Lesh - Medium
In Finnish-Goldman notation, what you do is pluralize observable variable names with a unicode character that matches the last letter of the pluralized...
Read more >
What does $ sign at the end of function name indicate?
The idea is that an Observable usually represents a stream of multiple Values and a pluralized variable / function name would indicate this....
Read more >
Create Rules - Imperva Documentation Portal
Create application delivery rules, or implement your own security and access control rules on top of Imperva's existing security logic.
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