dfinity / eslint-config-oisy-wallet

Shared ESLint configurations from the Oisy Wallet team
Apache License 2.0
2 stars 0 forks source link

feat: Add rules to enforce arrow functions #30

Closed AntonioVentilii-DFINITY closed 1 week ago

AntonioVentilii-DFINITY commented 1 month ago

Motivation

To further help with enforcing the arrow functions we add two rules and one plugin. This is one of the most suggested combination I found online:

Changes

Tests

The rules raised some new issues on this repo and we fixed them.

AntonioVentilii-DFINITY commented 1 month ago

@peterpeterparker note that the new plugin does not seem to be so well maintained (last version 4 years ago). However there is not much to mantain except bumping dependencies.

There is an alternative with this other plugin that is a fork actually and seems more recent: https://www.npmjs.com/package/eslint-plugin-prefer-arrow-functions

What would you suggest?

peterpeterparker commented 1 month ago

Do we need the plugin? Maybe the rules already cover enough use cases at least to get started?

AntonioVentilii-DFINITY commented 1 month ago

I checked and it would have not raised any issues, without that plugin, in this repo. What I can do is to create a "simpler" rule like the one provided in the new plugin but limited to our usage

peterpeterparker commented 1 month ago

I see. Sounds cool to me if you think it makes sense? Your call.

AntonioVentilii commented 1 week ago

So, update here, @peterpeterparker :

I tried to create our own rule, trimming the one provided by those library. But it is basically an entire copy/paste minus 10/15 lines (over 350 lines total)...

So, I think it is ok to use the library we are currently using (it had more than 1 million download in the last week), and we can always replace it with our own code in the future, IF and WHEN the time arrives.

WDYT?

github-actions[bot] commented 1 week ago

Thank you for contributing! Unfortunately this repository does not accept external contributions yet.

We are working on enabling this by aligning our internal processes and our CI setup to handle external contributions. However this will take some time to set up so in the meantime we unfortunately have to close this Pull Request.

We hope you understand and will come back once we accept external PRs.

— The DFINITY Foundation"""