javascript: Fix eslint errors in all exercises

I have configured eslint in https://github.com/exercism/javascript/pull/479

But have not fixed errors in any exercise apart from hello-world. Instead I added all exercises to .eslintignore.

The plan is to do this:

  1. Pick one exercise (You can pick many but we prefer to have separate PRs so that it is easy to review - but if there are not many changes - you can pick 2-3 at once).
  2. Remove the exercise name from .eslintignore file
  3. Run npm run lint - This should show errors in those exercises.
  4. Fix those errors - commit and raise a PR ๐ŸŽ‰

Note: The eslint configuration is not final. I did not have a good look at all errors, just put a sensible default in place. While fixing, if you encounter some error that you feel we should allow(ignore), feel free to comment on this issue.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 19 (17 by maintainers)

Commits related to this issue

Most upvoted comments

Iโ€™d like to work on this pls

@lukejpreston

Are there even any errors left?

We have disabled eslint errors using .eslintignore for all exercises and plan to fix errors in 1-2 exercises at a time. This is to make CI happy for now while using it to fix errors by removing the exercises we fix. (See PRs attached to this issue for reference).

but eslint --fix will auto fix loads

It fixes most of them but not all are fixable. You are free to use it but we would like to have each PR fix only 1-2 exercises entirely. This way it is easy to manage/review PRs.

Bitwise operators are not allowed Imho this is limiting for more advanced coders. I think we should allow it, or at least downgrade it from an error to a warning (if that makes it pass CI).

According to eslint the reason this is because people tend to make typos of | when they want || and same for & and &&. I think since we have test-cases, we need not worry about this and limit ourselves from using bitwise operators when needed - sometimes they lead to really elegant and efficient solutions. So I agree upon disabling this rule at project level.

@adamxtokyo Thanks for contributing! We do not want to create separate issues for each PRs. Because the steps outlined in this issue description will be same for all exercises. For more clarity you are advised to look into linked PRs for other exercises. Discussion related to specific exercise as required can be taken up on the PR itself. Otherwise before starting if you have any doubts, you can always comment here.

Regarding contributing guidelines, that is a good point that you brought up. We have quite a few things going on in the CI and elsewhere that we should have a separate document explaining them. I will create a new issue for this thanks! Also I will look into your PR shortly.

@Futuro212 letโ€™s not comment on related, but different, closed issues please. Would you mind opening a separate, new issue for this? Hopefully someone can help. Thanks!

I think the hacktoberfest label should be added to this issue, as it might help get this issue resolved faster

Trying my hand at helping out if there are no issues with it. ๐Ÿ˜ƒ Should be able to bust out a few.

@gargrave @tejasbubane @tarunvelli Iโ€™m looking at the PRs now. Thanks for the patience.

Thanks a lot for the PRs! I am on a vacation for a week and would be able to look at them next week only. Meanwhile some other maintainers might have a chance to review.