CodeHubOrg / codehub-mentorships

CodeHub Mentorship platform - built with Laravel and React
3 stars 0 forks source link

Fix lint errors and fix the lint command run by GitHub action #82

Closed NeverFearTheasHere closed 4 years ago

NeverFearTheasHere commented 4 years ago

The GitHub action I set up was running eslint with the --fix option. This option is really useful when running the command locally because it automatically fixes any linting errors which are auto-fixable. However it doesn't really make sense for the GitHub action to run that command because it will succeed even if there are linting errors, as long as those linting errors could be auto-fixed. The GitHub action doesn't currently commit the auto-fixed changed (although maybe that would be a cool feature I should look into adding! 🤓 ) so I think this is a problem as it's giving us false-positives for our linting CI checks.

I've changed the GitHub action to run a new npm task lint:ci which is the same as the normal lint task apart from it doesn't include the autofix option, so it will fail if there are any linting violations.

If you are about to push a branch with some frontend changes, it's probably worth running npm run lint or yarn lint before you push, so you can commit any auto-fixable errors that catches or fix any other errors that it highlights. Or just use a plugin for your favourite editor, such as this one for vscode or this one for Sublime.

The other commit in this PR (e619d2d) is less interesting - that's just me committing the result of running yarn lint 😄

katjad commented 4 years ago

Thanks Thea, that's great. I'll try to remember to always run the linter before commiting. :)