Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pre-commit tests #40

Closed
wants to merge 2 commits into from
Closed

Add pre-commit tests #40

wants to merge 2 commits into from

Conversation

andrewnicols
Copy link
Member

@andrewnicols andrewnicols commented Apr 12, 2022

This change adds a few bits all in one:

  • eslint configuration
  • cspell configuration
  • husky and lint-staged to perform a pre-commit hook lint rewrite and spell-check

This is not quite ready, but it would be good to try it otu and see what you think.

@sarjona
Copy link
Member

sarjona commented Apr 13, 2022

Thanks for keep adding interesting and useful tools to the devdocs repository!!

I've been playing with your branch and the husky and lint-staged tools were working as expected (I've also seen they have helped to identify and fix some styling issues in JS... Well done!).

However, while playing, I missed the option to run eslint without having to add these files to stash (besides, while fixing the errors, I forgot to add the file again to stash).
Am I doing something wrong/missing anything or is that expected? I can see it will help to identify issues when we're pushing changes (as CiBoT does), but I also feel it would be great to be able to run them locally while you're working on a patch (before committing changes).

@andrewnicols
Copy link
Member Author

However, while playing, I missed the option to run eslint without having to add these files to stash (besides, while fixing the errors, I forgot to add the file again to stash).

How were you hoping to run eslint?

You can run npx eslint [filepath] or yarn eslint [filepath] and you can add the --fix argument too.

I don't believe there's any way to run eslint without providing a path - in Moodle we use grunt to call eslint and our Gruntfile.js works out the most appropriate files to pass and passes them without your knowledge.

I believe it's the same for stylelint (npx stylelint [filepath] or yarn stylelint [filepath])

@andrewnicols andrewnicols mentioned this pull request Apr 15, 2022
4 tasks
@andrewnicols andrewnicols deleted the husky branch April 15, 2022 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants