usaco-guide icon indicating copy to clipboard operation
usaco-guide copied to clipboard

Automatic Formatter Pre-Commit Hook?

Open bqi343 opened this issue 3 years ago • 3 comments

Related to #2292, it would be great if there was some way to automatically detect (and fix?) some of the most egregious violations of the conventions (at the very least, spaces vs tabs).

bqi343 avatar Jan 07 '22 01:01 bqi343

should this be an additional feature of the maggie-bot? like "hey, we noticed you're using spaces, please fix this?" thing is, an issue is that the backend website code uses spaces, so how would we differentiate between the two?

SansPapyrus683 avatar May 19 '22 04:05 SansPapyrus683

if there was some way to automatically detect

in create-xdm-node.ts it's probably possible to add a plugin that parses the MDX AST to find all the code blocks and check for spaces vs tabs. Then this plugin can throw an error if any obvious issue is found.

(and fix?)

this one I'm not sure about -- possibly some custom Prettier plugin?


Dunno whether this is worth the time investment though... We're currently using XDM for our markdown stuff. At some point when Gatsby finishes up their mdx plugin, we should switch back to mdx v2 (which is very similar to XDM but will actually be maintained in the future).

thecodingwizard avatar Jun 22 '22 08:06 thecodingwizard

so any possible resolution for this?

SansPapyrus683 avatar Sep 16 '22 03:09 SansPapyrus683