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

Scripts: Remove deprecated format-js command #40512

Merged
merged 4 commits into from
Apr 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 23 additions & 19 deletions docs/how-to-guides/data-basics/1-data-basics-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,39 @@ Also, this tutorial will lean heavily on Redux concepts such as state, actions,

We'll do all the development inside of a WordPress plugin. Let's start by creating a `wp-content/plugins/my-first-gutenberg-app` directory in your local WordPress environment. We will need to create four files inside that directory:

* my-first-gutenberg-app.php – to create a new admin page
* src/index.js – for our JavaScript application
* style.css – for the minimal stylesheet
* package.json – for the build process
- my-first-gutenberg-app.php – to create a new admin page
Copy link
Member Author

Choose a reason for hiding this comment

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

I have Prettier integrated with my IDE and this is why these changes got included. It's also surprising because all Markdown files were formatted with Prettier a few months ago...

Copy link
Contributor

@ockham ockham Apr 21, 2022

Choose a reason for hiding this comment

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

Yeah, that's kinda weird 🤔 I hope that we don't end up accidentally using different configs for prettier/markdown in our scripts and in our editor configs.

Anyway, it's just whitespace 😬 Even if this wasn't the format we want, it wouldn't be the end of the world.

- src/index.js – for our JavaScript application
- style.css – for the minimal stylesheet
- package.json – for the build process

Go ahead and create these files using the following snippets:

**src/index.js:**

```js
import { render } from '@wordpress/element';

function MyFirstApp() {
return <span>Hello from JavaScript!</span>;
}

window.addEventListener( 'load', function() {
render(
<MyFirstApp />,
document.querySelector( '#my-first-gutenberg-app' )
);
}, false );
window.addEventListener(
'load',
function () {
render(
<MyFirstApp />,
document.querySelector( '#my-first-gutenberg-app' )
);
},
false
);
```

**style.css:**

```css
.toplevel_page_my-first-gutenberg-app #wpcontent {
background: #FFF;
background: #fff;
height: 1000px;
}
#my-first-gutenberg-app {
Expand Down Expand Up @@ -68,6 +74,7 @@ window.addEventListener( 'load', function() {
```

**my-first-gutenberg-app.php:**

```php
<?php
/**
Expand Down Expand Up @@ -143,10 +150,7 @@ add_action( 'admin_enqueue_scripts', 'load_custom_wp_admin_scripts' );
"description": "Example: Recipe Card (ESNext).",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
"keywords": [
"WordPress",
"block"
],
"keywords": [ "WordPress", "block" ],
"homepage": "https://github.com/WordPress/gutenberg-examples/",
"repository": "git+https://github.com/WordPress/gutenberg-examples.git",
"bugs": {
Expand All @@ -158,7 +162,7 @@ add_action( 'admin_enqueue_scripts', 'load_custom_wp_admin_scripts' );
},
"scripts": {
"build": "wp-scripts build",
"format:js": "wp-scripts format-js",
"format": "wp-scripts format",
"lint:js": "wp-scripts lint-js",
"packages-update": "wp-scripts packages-update",
"start": "wp-scripts start"
Expand All @@ -184,6 +188,6 @@ Congratulations! You are now ready to start building the app!

## What's next?

* Previous part: [Introduction](/docs/how-to-guides/data-basics/README.md)
* Next part: [Building a basic list of pages](/docs/how-to-guides/data-basics/2-building-a-list-of-pages.md)
* (optional) Review the [finished app](https://github.com/WordPress/gutenberg-examples/tree/trunk/09-code-data-basics-esnext) in the gutenberg-examples repository
- Previous part: [Introduction](/docs/how-to-guides/data-basics/README.md)
- Next part: [Building a basic list of pages](/docs/how-to-guides/data-basics/2-building-a-list-of-pages.md)
- (optional) Review the [finished app](https://github.com/WordPress/gutenberg-examples/tree/trunk/09-code-data-basics-esnext) in the gutenberg-examples repository
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@
"fixtures:generate": "cross-env GENERATE_MISSING_FIXTURES=y npm run test-unit test/integration/full-content/ && npm run format test/integration/fixtures/blocks/*.json",
"fixtures:regenerate": "npm run fixtures:clean && npm run fixtures:generate",
"format": "wp-scripts format",
"format-js": "wp-scripts format-js",
"format-php": "wp-env run composer run-script format",
"lint": "concurrently \"npm run lint-lockfile\" \"npm run lint-js\" \"npm run lint-pkg-json\" \"npm run lint-css\"",
"lint-js": "wp-scripts lint-js",
Expand Down
4 changes: 4 additions & 0 deletions packages/scripts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

## Breaking Changes

- Remove the previously deprecated and undocumented `format-js` command ([#40512](https://github.com/WordPress/gutenberg/pull/40512)). You should use the `format` command instead.

## 22.4.0 (2022-04-08)

### New Feature
Expand Down
36 changes: 0 additions & 36 deletions packages/scripts/scripts/format-js.js

This file was deleted.