Closed disposedtrolley closed 4 years ago
I've been thinking about this too.
EditorConfig would also be useful to guarantee end-of-line and indentation consistency.
We could also implement prettier for code formatting.
@michaeldiguiseppi, in my opinion Prettier alone is too opiniated and enforces some annoying rules sometimes. I also think it's not very suitable for us since a lot of Asobo files are already weirdly formatted and Its lack of configurability would not let us tune those warnings down.
ESLint can inherit Prettier's rule set anyway and has the advantage of being able to let the user disable certain rules.
Ironically, a lot of the Asobo code follows different formatting rules too, which doesn't make things any easier. :)
Ironically, a lot of the Asobo code follows different formatting rules too, which doesn't make things any easier. :)
Yeah, that's the thing.
I think we can start by adding linter config files (ESLint, EditorConfig, not sure what to use for XML) and encouraging people to use them. Let them print out warnings in checks. Encourage people to fix formatting whenever they have the chance.
Then, when a lot of code has better formatting, we can start enforcing it.
i just added eslint in #1130, will figure out prettier or something for all other files
closing in favor of #761
I've witnessed a tremendous amount of progress being made on this project in the few days I've known about it. It's incredible to see how passionate the flight sim community is in giving up their time to work on freeware!
In an effort to keep this project scalable and maintainable, what do we think about introducing linting and code formatting for the HTML, CSS, and JS files in particular? This would allow for a consistent style across the codebase, reduce the amount of complexity required when dealing with any merge conflicts, and reduce overhead for contributors when thinking about how code should be formatted. The linter can also catch basic issues via static analysis.
I'm happy to investigate some tools and spike it out in a PR if there's interest. ESLint is quite comprehensive and does double duty of linting and code formatting.
The main challenge will be to roll this out with minimal disruption to inflight features and PRs. Perhaps we can introduce another step in CI to run the formatter and commit changes?