This repository was archived by the owner on Mar 3, 2023. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR is a follow-up of #19302 (next step 1. from the summary of that PR) to enable the
prettiereslintconfig and reformat all JS files to follow it.This means that once this is merged, the linter will complain whenever a file does not have the correct prettier formatting (this includes whitespace, line lengths, etc).
Good thing is that fixing the formatting is as easy as running
script/lint --fixfrom the command line, or even better you can install theprettier-atompackage and turn on the "format on save" setting to automatically format the code (this changed my life when I started using it).In order to create this PR, in the first commit I've just modified the
.eslintrc.jsonfile to enable the prettier rule and tweaked theprettierconfig to use semicolons, which is the standard configuration of prettier (as suggested by @nathansobo).On the second commit I've reformatted all the files by running
script/lint --fix.Motivation
This will provide a few benefits:
Drawbacks
This commit touches a toon of files and lines, and this adds a few drawbacks:
masterto any release branch after this PR gets merged.How I'm planning to merge this
Taking into account the drawbacks, this is my current strategy to merge this if nobody sees issues with this PR:
#atom-maintainersabout this PR, so if anybody has a big WIP branch they have some time to merge it.master, re-generate the reformatting commit and merge it.The dates are carefully chosen so this will land 1 week before the branch cut for the next release. I think this is the sweet spot by being early enough to have enough time to spot any unexpected issue (although the changes should only affect formatting) and being late enough so the chances of us having to cherry-pick a commit from
masterinto a release branch are very low.Questions
I have a big WIP branch which is not going to be ready by May 31st, what should I do?
Next time you should try to work more incrementally 😁. Nah just kidding, if your branch focuses on a specific file/files or adds new files, you can already enable
prettieron your branch files, so they get formatted correctly before this PR gets merged and you won't get conflicts. To do so, you can just add a new override on theeslintrcconfig:{ "files": ["globs_that_match_your_pr_files"], "rules": { "prettier/prettier": ["error"] } }Once you do that, you can run
script/lint --fixand your PR files will get auto-formatted.What happens with the electron upgrade?
Luckily, the current upgrade branch does not touch many JS files, so there are not going to be many conflicts.
Having said that, if on May 31st we see that there's still possibilities that we need to revert the electron branch, I'll consider postponing the merge of this PR.
/cc @atom/maintainers