animal-crossing-music-extension / ac-music-extension

Google Chrome extension that plays hourly Animal Crossing music and more while browsing!
https://acmusicext.com
zlib License
343 stars 57 forks source link

[WIP] Configure Javascript linter #86

Open jordigarcl opened 4 years ago

jordigarcl commented 4 years ago

Related to #51. I open the PR for discussion before investing more time.

This is a POC to configureeslintthrough npm.

Now npx eslint . can be locally run from the root of the project to analyse the code. We can run npx eslint --fix . before merging this to solve most formatting issues but didn't include it here not to obfuscate the tool config.

Drawback:

Due to the Chrome opaque way of including javascript modules, the analysis reports lots of no-unused-vars and no-undef errors. These could be disabled, but I think that they would provide very useful information for catching variables that break the build. To do so, false positives must be prevented.

I suggest to do this by manually including /* global ... */ and /* exported ... */ header comments in each file to manually disable the check where needed.

This would be a major hassle. I believe that once done, maintenance should be easy (run the tool before merging a PR). I did so for AudioManager so you could see what I mean.

I leave it to you guys to discuss!

Julian-MJK commented 4 years ago

As this project grows and more people wish to contribute, this would be a great way to keep the code clean & readable, and through that, more easily expandable, despite the difficulty of the initial implementation!