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

Format and lint #894

Merged
merged 19 commits into from
Dec 16, 2020
Merged

Format and lint #894

merged 19 commits into from
Dec 16, 2020

Conversation

SleeplessByte
Copy link
Member

  • enable eslint for all exercises
  • format all files the same way
  • fix a stub (simple-linked-list)

@tejasbubane
Copy link
Member

@SleeplessByte This is so good! 💚

enable eslint for all exercises

Do we need the .prettierrc file? I am a little confused here because I don't see prettier anywhere in the codebase.

Will CI check for lint be added in separate PR?

@SleeplessByte
Copy link
Member Author

I didn't yet decide if we wanted to add it by default, but first wanted to see your reaction hehehehe.

I'll add it to the maintainers workflow and I'll add the CI. We already have it for v3, so easy copy.

This file has been replaced by npx babel-node scripts/lint
This file has been replaced by npx babel-node scripts/test
These have been replaced by npx babel-node sync
@SleeplessByte SleeplessByte requested a review from a team as a code owner December 16, 2020 20:04
@SleeplessByte SleeplessByte added chore 🔧 Meta related task such as build, test, linting, maintainers.json etc. documentation 📖 Documentation changes labels Dec 16, 2020
@SleeplessByte
Copy link
Member Author

SleeplessByte commented Dec 16, 2020

@tejasbubane

  • It now checks formatting in CI
  • It forces the same consistent version of prettier for formatting and checking it
  • It adds npx babel-node scripts/format to run prettier
  • It adds instructions in the docs about that new action
  • It adds instructions in the docs about how to set-up your editor to "automatically" do it.

In reality, code formatted between version 2.x and 2.y is going to be very similar if not the same, so most of the time prettier will "just work" in editors. We just don't want to auto-install a version that has to be kept in sync with the repo unless that's necessary. We can later decide to add it as devDependency (but remove it in the exercises, like shelljs).

Bonus. On any future pr, add a comment with:

/format

and it will auto-format the code and commit it. No need to install/run anything.

EXAMPLE: #839 (comment)

@SleeplessByte SleeplessByte merged commit 77f4761 into master Dec 16, 2020
@SleeplessByte SleeplessByte deleted the chore/format-and-lint branch December 16, 2020 20:41
@tejasbubane
Copy link
Member

Amazing work @SleeplessByte 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore 🔧 Meta related task such as build, test, linting, maintainers.json etc. documentation 📖 Documentation changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants