NodeBB/nodebb-plugin-markdown

Husky crazyness

Dravere opened this issue · 7 comments

So you implemented automatic lint checking and similar things. But it seems there are at least two mis-configurations at the moment, which prevent some valid type of commits entirely.

  • You can't change admin.js at the moment. admin.js is not valid according to your lint settings. It seems to have missing global definitions and missing the 'use strict' at the beginning of the file. I'm very unfamiliar with the type of lint checking you use, thus I'm unable to fix it myself.
  • The file highlight.js is linted when it is changed. Which obviously will generated large amounts of errors. The file should better be ignored.

Hi @Dravere -- I use an .eslintrc which is identical to the one in NodeBB core itself. In vscode I use the eslint plugin which highlights errors and autofixes on save (though I think the latter is an option you have to toggle).

Husky and lint-staged only throw errors on staged files, which is why you're only seeing errors now. You should lint the files properly first before making changes (otherwise your changes get lost in between the noise from the eslint fixes).

ESLint shouldn't throw errors with highlight.js, I think... since that's not a file that's ever staged 🤔

Just FYI there are some binaries installed that might help... node_modules/.bin/eslint --fix {filename} comes to mind, though I just go into the file manually and hit ctrl-S to invoke the autofixer.

Let me know if that gets you going again 😄

Seems to be good now. At least in regards to admin.js. I think the thing with the highlight.js was, that I changed that file previously and the merge of the current state changed highlight.js and thus wanted to lint it and failed at it. Thus whenever you want to update the highlight.js file you might run into problems with it.

Oh, I missed that in the commit. Just tested it as well by just changing something in highlight.js. Yes it works now as well. Thank you very much!