jbampton commented on pull request #3624:
URL: https://github.com/apache/apisix/pull/3624#issuecomment-816103098


   > Our project is not a Python project. Can it fix the markdown / yaml 
automatically?
   
   Hey @spacewander as I mentioned before I have worked with `overcommit` and 
`pre-commit` but on some other projects I did also work with `husky`.  `husky` 
is huge in the JavaScript world as it's mainly JS.
   
   https://typicode.github.io/husky/#/
   https://www.npmjs.com/package/husky
   https://github.com/typicode/husky
   
   I think for sure `pre-commit` is the best and more research and work is 
needed to get all this working well.  And we need more docs on all of this.
   
   Auto fixing Markdown and YAML can be done to some degree for example the 
`markdownlint-cli` tool can auto fix basic errors.  Whilst we are not a Python 
project there is a Python tool that does format YAML files.  From what I can 
see `Prettier` which is mainly written in JavaScript and can run on 
`pre-commit` is now best in class for code formatting. `Prettier` is an 
opinionated code formatter and has about 39,000+ Stars.  With `Prettier` there 
are five different ways to implement the `pre-commit` check.  Seems `Prettier` 
is the way to go at least for some `pre-commit` checks and it seems that one of 
the best features of `pre-commit` is the added automation.
   
   What I am trying to say is sometimes in software development some of the 
best tools that you need are written in another language or not the main 
language that you use on a project. 
   
   There are some projects for Lua which I have never used so not really sure 
about them but seems some don't support the correct versions of Lua.
   
   https://github.com/igorshubovych/markdownlint-cli
   https://pypi.org/project/yamlfmt/
   https://prettier.io/
   https://prettier.io/docs/en/precommit.html
   https://gitlab.com/pablodiehl/pre-commit-lua-formatter
   https://github.com/starwing/lua-fmt
   https://luarocks.org/modules/xavier-wang/lua-fmt
   https://luarocks.org/modules/luarocks/formatter
   
   <img width="1095" alt="Screen Shot 2021-04-09 at 4 52 56 am" 
src="https://user-images.githubusercontent.com/418747/114083610-8c66ff80-98f2-11eb-9ed4-82ea06afccad.png";>
   
   <img width="642" alt="Screen Shot 2021-04-09 at 4 55 07 am" 
src="https://user-images.githubusercontent.com/418747/114083658-9d177580-98f2-11eb-81cb-d57a9a9f4a93.png";>
   
   And from Prettier site:
   
   <img width="935" alt="Screen Shot 2021-04-09 at 5 18 47 am" 
src="https://user-images.githubusercontent.com/418747/114084131-2b8bf700-98f3-11eb-9008-4a8de709924b.png";>
   
   <img width="1335" alt="Screen Shot 2021-04-09 at 5 06 04 am" 
src="https://user-images.githubusercontent.com/418747/114083736-b7e9ea00-98f2-11eb-8821-18be31fe09ea.png";>
   
   <img width="1474" alt="Screen Shot 2021-04-09 at 5 06 16 am" 
src="https://user-images.githubusercontent.com/418747/114083826-d0f29b00-98f2-11eb-99de-f7a218b37940.png";>
   
   <img width="1434" alt="Screen Shot 2021-04-09 at 5 19 15 am" 
src="https://user-images.githubusercontent.com/418747/114084205-40688a80-98f3-11eb-95dc-547ab6096466.png";>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to