Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefer custom eslint rules over abstract classes #102

Open
lucacamplimrf opened this issue Dec 17, 2018 · 0 comments
Open

Prefer custom eslint rules over abstract classes #102

lucacamplimrf opened this issue Dec 17, 2018 · 0 comments
Labels
enhancement New feature or request

Comments

@lucacamplimrf
Copy link
Contributor

In order "force" the developer to define a method for certain classes we are using Abstract classes with a method that throws ( for instance the AbstractTracker ).
This approach has different downfalls:

  • The error will throw only at runtime.
  • We are adding more code to the bundle.
  • If the developer knows about the asbtract class he probably already knows that he has to implement those methods. If he doesn't know, he will not extend from it, and no error will be thrown at runtime.

A more convenient solution would be to create a custom eslint rule which would apply to all the files inside a path. For instance we could define a rule where is mandatory for all the classes living inside the path features/metrics to define a static buildFromJson method.

@lucacamplimrf lucacamplimrf added the enhancement New feature or request label Dec 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant