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

chore(formatting): Remove @format pragma from codebase #37591

Merged
merged 3 commits into from
Nov 14, 2019

Conversation

blowery
Copy link
Contributor

@blowery blowery commented Nov 14, 2019

Changes proposed in this Pull Request

  • Remove the @Format pragma from the codebase
  • Fix the pre-commit-script to handle large changes

Testing instructions

  • e2es should cover this

@blowery blowery requested review from a team as code owners November 14, 2019 10:26
@matticbot
Copy link
Contributor

@blowery blowery self-assigned this Nov 14, 2019
@blowery blowery added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. [Status] Needs e2e Testing Framework labels Nov 14, 2019
@matticbot
Copy link
Contributor

matticbot commented Nov 14, 2019

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

Webpack Runtime (~56 bytes removed 📉 [gzipped])

name      parsed_size           gzip_size
manifest       -210 B  (-0.1%)      -56 B  (-0.2%)

Webpack runtime for loading modules. It is included in the HTML page as an inline script. Is downloaded and parsed every time the app is loaded.

App Entrypoints (~20 bytes removed 📉 [gzipped])

name        parsed_size           gzip_size
entry-main       -187 B  (-0.0%)      -20 B  (-0.0%)

Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used.

Sections (~1419 bytes removed 📉 [gzipped])

name         parsed_size           gzip_size
woocommerce       -136 B  (-0.0%)     -805 B  (-0.1%)
settings          -136 B  (-0.0%)     -658 B  (-0.5%)
devdocs            -42 B  (-0.0%)       -3 B  (-0.0%)
account            -21 B  (-0.0%)      +47 B  (+0.1%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Async-loaded Components (~80 bytes added 📈 [gzipped])

name                          parsed_size           gzip_size
async-load-design-playground        -21 B  (-0.0%)      +58 B  (+0.0%)
async-load-design-blocks            -21 B  (-0.0%)       -2 B  (-0.0%)
async-load-design                   -21 B  (-0.0%)      +24 B  (+0.0%)

React components that are loaded lazily, when a certain part of UI is displayed for the first time.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

Copy link
Contributor

@ockham ockham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems about right. Thanks for taking care of this! Merge pending e2e tests 👍

@blowery
Copy link
Contributor Author

blowery commented Nov 14, 2019

Still a bunch of @format pragmas embedded in bigger comment blocks. Working on removing those too.

@sirreal
Copy link
Member

sirreal commented Nov 14, 2019

FYI: I was annoyed by this, tried some sed-style removal and eventually wrote a codemod: Automattic/calypso-codemods#10

I was planning to get that merged, but was waiting on #36645.

No opposition to going ahead with this, just so you're aware that there's an implemented alternative that may make this easy.

@blowery
Copy link
Contributor Author

blowery commented Nov 14, 2019

No opposition to going ahead with this, just so you're aware that there's an implemented alternative that may make this easy.

Wasn't too bad to replace with a few regexp searches. It's unique enough that it's pretty easy to find and replace.

A while back, we removed the need for the @Format pragma in source to enable auto-formatting with prettier. We can now remove it entirely.
@blowery blowery merged commit f2c9d99 into master Nov 14, 2019
@blowery blowery deleted the fix/remove-format-pragma branch November 14, 2019 14:58
@matticbot matticbot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Nov 14, 2019
simison added a commit that referenced this pull request Nov 22, 2019
simison added a commit that referenced this pull request Nov 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants