Skip to content

Format and lint - #894

Merged
SleeplessByte merged 19 commits into
masterfrom
chore/format-and-lint
Dec 16, 2020
Merged

SleeplessByte merged 19 commits into
masterfrom
chore/format-and-lint

Conversation

@SleeplessByte

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

@tejasbubane

Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread exercises/all-your-base/README.md Outdated
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

SleeplessByte commented Dec 16, 2020 •

Copy link
Copy Markdown
Member Author

@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
Copy Markdown
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