statgen / locuszoom

A Javascript/d3 embeddable plugin for interactively visualizing statistical genetic data from customizable sources.
https://statgen.github.io/locuszoom/
MIT License
156 stars 29 forks source link

JS formatter #278

Closed sir4ur0n closed 2 years ago

sir4ur0n commented 2 years ago

Please document the JS formatter to use on LocusZoom code base (I guess somewhere in https://github.com/statgen/locuszoom#development-setup) and - if applicable - provide the formatter configuration file :pray:

sir4ur0n commented 2 years ago

Apparently, some formatting at least can be achieved with eslint --fix esm/ test/ (e.g. for indentation inside an if block), but I don't know if this covers every formatting concern?

abought commented 2 years ago

As you suspected, the formatter we use is eslint. We check it for relevant code files (and verify this in CI).

All format rules should be applied correctly using the --fix command, detecting correct options from the provided .eslintrc config file in this repo- I'll try to add the auto-fix command to the README. In theory someone could create a simple pre-commit hook to do this for their own setup; I use an editor (pycharm) that runs eslint and warns me as I work.

If you're seeing different rules in CI vs locally, it's possible that you are using a globally installed version of eslint that is older/newer, and applying different rules. If that's the case let me know and it's worth following up.