Skip to content

Commit

Permalink
Merge changes published in the Gutenberg plugin "release/7.4" branch
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo committed Feb 4, 2020
1 parent 3e867dd commit 30bc64c
Show file tree
Hide file tree
Showing 1,992 changed files with 67,381 additions and 34,444 deletions.
3 changes: 1 addition & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ packages/e2e-tests/plugins
playground/dist
vendor
wordpress

!.eslintrc.js
!.*.js
125 changes: 73 additions & 52 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ const { version } = require( './package' );
*
* @type {string}
*/
const majorMinorRegExp = escapeRegExp( version.replace( /\.\d+$/, '' ) ) + '(\\.\\d+)?';
const majorMinorRegExp =
escapeRegExp( version.replace( /\.\d+$/, '' ) ) + '(\\.\\d+)?';

/**
* The list of patterns matching files used only for development purposes.
Expand All @@ -33,9 +34,7 @@ module.exports = {
'plugin:@wordpress/eslint-plugin/recommended',
'plugin:eslint-comments/recommended',
],
plugins: [
'import',
],
plugins: [ 'import' ],
globals: {
wp: 'off',
},
Expand All @@ -49,63 +48,88 @@ module.exports = {
// we'll get a `SyntaxError` (Invalid regular expression: \ at end of pattern)
// here. That's why we use \\u002F in the regexes below.
{
selector: 'ImportDeclaration[source.value=/^@wordpress\\u002F.+\\u002F/]',
message: 'Path access on WordPress dependencies is not allowed.',
selector:
'ImportDeclaration[source.value=/^@wordpress\\u002F.+\\u002F/]',
message:
'Path access on WordPress dependencies is not allowed.',
},
{
selector: 'ImportDeclaration[source.value=/^react-spring(?!\\u002Fweb\.cjs)/]',
message: 'The react-spring dependency must specify CommonJS bundle: react-spring/web.cjs',
selector:
'ImportDeclaration[source.value=/^react-spring(?!\\u002Fweb.cjs)/]',
message:
'The react-spring dependency must specify CommonJS bundle: react-spring/web.cjs',
},
{
selector: 'CallExpression[callee.name="deprecated"] Property[key.name="version"][value.value=/' + majorMinorRegExp + '/]',
message: 'Deprecated functions must be removed before releasing this version.',
selector:
'CallExpression[callee.name="deprecated"] Property[key.name="version"][value.value=/' +
majorMinorRegExp +
'/]',
message:
'Deprecated functions must be removed before releasing this version.',
},
{
selector: 'CallExpression[callee.name=/^(__|_n|_nx|_x)$/]:not([arguments.0.type=/^Literal|BinaryExpression$/])',
message: 'Translate function arguments must be string literals.',
selector:
'CallExpression[callee.name=/^(__|_n|_nx|_x)$/]:not([arguments.0.type=/^Literal|BinaryExpression$/])',
message:
'Translate function arguments must be string literals.',
},
{
selector: 'CallExpression[callee.name=/^(_n|_nx|_x)$/]:not([arguments.1.type=/^Literal|BinaryExpression$/])',
message: 'Translate function arguments must be string literals.',
selector:
'CallExpression[callee.name=/^(_n|_nx|_x)$/]:not([arguments.1.type=/^Literal|BinaryExpression$/])',
message:
'Translate function arguments must be string literals.',
},
{
selector: 'CallExpression[callee.name=_nx]:not([arguments.3.type=/^Literal|BinaryExpression$/])',
message: 'Translate function arguments must be string literals.',
selector:
'CallExpression[callee.name=_nx]:not([arguments.3.type=/^Literal|BinaryExpression$/])',
message:
'Translate function arguments must be string literals.',
},
{
selector: 'CallExpression[callee.name=/^(__|_x|_n|_nx)$/] Literal[value=/\\.{3}/]',
selector:
'CallExpression[callee.name=/^(__|_x|_n|_nx)$/] Literal[value=/\\.{3}/]',
message: 'Use ellipsis character (…) in place of three dots',
},
{
selector: 'ImportDeclaration[source.value="redux"] Identifier.imported[name="combineReducers"]',
selector:
'ImportDeclaration[source.value="redux"] Identifier.imported[name="combineReducers"]',
message: 'Use `combineReducers` from `@wordpress/data`',
},
{
selector: 'ImportDeclaration[source.value="lodash"] Identifier.imported[name="memoize"]',
selector:
'ImportDeclaration[source.value="lodash"] Identifier.imported[name="memoize"]',
message: 'Use memize instead of Lodash’s memoize',
},
{
selector: 'CallExpression[callee.object.name="page"][callee.property.name="waitFor"]',
selector:
'CallExpression[callee.object.name="page"][callee.property.name="waitFor"]',
message: 'Prefer page.waitForSelector instead.',
},
{
selector: 'JSXAttribute[name.name="id"][value.type="Literal"]',
message: 'Do not use string literals for IDs; use withInstanceId instead.',
message:
'Do not use string literals for IDs; use withInstanceId instead.',
},
{
// Discourage the usage of `Math.random()` as it's a code smell
// for UUID generation, for which we already have a higher-order
// component: `withInstanceId`.
selector: 'CallExpression[callee.object.name="Math"][callee.property.name="random"]',
message: 'Do not use Math.random() to generate unique IDs; use withInstanceId instead. (If you’re not generating unique IDs: ignore this message.)',
selector:
'CallExpression[callee.object.name="Math"][callee.property.name="random"]',
message:
'Do not use Math.random() to generate unique IDs; use withInstanceId instead. (If you’re not generating unique IDs: ignore this message.)',
},
{
selector: 'CallExpression[callee.name="withDispatch"] > :function > BlockStatement > :not(VariableDeclaration,ReturnStatement)',
message: 'withDispatch must return an object with consistent keys. Avoid performing logic in `mapDispatchToProps`.',
selector:
'CallExpression[callee.name="withDispatch"] > :function > BlockStatement > :not(VariableDeclaration,ReturnStatement)',
message:
'withDispatch must return an object with consistent keys. Avoid performing logic in `mapDispatchToProps`.',
},
{
selector: 'LogicalExpression[operator="&&"][left.property.name="length"][right.type="JSXElement"]',
message: 'Avoid truthy checks on length property rendering, as zero length is rendered verbatim.',
selector:
'LogicalExpression[operator="&&"][left.property.name="length"][right.type="JSXElement"]',
message:
'Avoid truthy checks on length property rendering, as zero length is rendered verbatim.',
},
],
},
Expand All @@ -127,37 +151,34 @@ module.exports = {
...developmentFiles,
],
rules: {
'react/forbid-elements': [ 'error', {
forbid: [
[ 'button', 'Button' ],
[ 'circle', 'Circle' ],
[ 'g', 'G' ],
[ 'path', 'Path' ],
[ 'polygon', 'Polygon' ],
[ 'rect', 'Rect' ],
[ 'svg', 'SVG' ],
].map( ( [ element, componentName ] ) => {
return {
element,
message: `use cross-platform <${ componentName } /> component instead.`,
};
} ),
} ],
'react/forbid-elements': [
'error',
{
forbid: [
[ 'button', 'Button' ],
[ 'circle', 'Circle' ],
[ 'g', 'G' ],
[ 'path', 'Path' ],
[ 'polygon', 'Polygon' ],
[ 'rect', 'Rect' ],
[ 'svg', 'SVG' ],
].map( ( [ element, componentName ] ) => {
return {
element,
message: `use cross-platform <${ componentName } /> component instead.`,
};
} ),
},
],
},
},
{
files: [
'packages/jest*/**/*.js',
],
extends: [
'plugin:@wordpress/eslint-plugin/test-unit',
],
files: [ 'packages/jest*/**/*.js' ],
extends: [ 'plugin:@wordpress/eslint-plugin/test-unit' ],
},
{
files: [ 'packages/e2e-test*/**/*.js' ],
extends: [
'plugin:@wordpress/eslint-plugin/test-e2e',
],
extends: [ 'plugin:@wordpress/eslint-plugin/test-e2e' ],
},
],
};
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

# Blocks
/packages/block-library @Soean @ajitbohra @jorgefilipecosta @talldan
/packages/block-library/src/gallery @mkevins @pinarol
/packages/block-library/src/social-links @mkaz
/packages/block-library/src/social-link @mkaz

Expand All @@ -37,6 +38,7 @@
/packages/babel-plugin-makepot @ntwb @nerrad @ajitbohra
/packages/babel-preset-default @youknowriad @gziolo @ntwb @nerrad @ajitbohra
/packages/browserslist-config @gziolo @ntwb @nerrad @ajitbohra
/packages/create-block @gziolo
/packages/custom-templated-path-webpack-plugin @ntwb @nerrad @ajitbohra
/packages/docgen @nosolosw
/packages/e2e-test-utils @gziolo @ntwb @nerrad @ajitbohra
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/pull-request-automation.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
on: pull_request
on:
pull_request:
types: [opened, closed]
name: Pull request automation

jobs:
pull-request-automation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
# Checkout defaults to using the branch which triggered the event, which
# isn't necessarily `master` (e.g. in the case of a merge).
- uses: actions/checkout@v2
with:
ref: master
# Changing into the action's directory and running `npm install` is much
# faster than a full project-wide `npm ci`.
- run: cd packages/project-management-automation && npm install
Expand Down
9 changes: 9 additions & 0 deletions .markdownlintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
bin
build
node_modules
phpunit
playground
storybook
test
vendor
wordpress
3 changes: 3 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Import the default config file and expose it in the project root.
// Useful for editor integrations.
module.exports = require( '@wordpress/scripts/config/.prettierrc.js' );
36 changes: 11 additions & 25 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,24 @@
# Contributing
# Contributing Guidelines

Thank you for thinking about contributing to WordPress' Gutenberg project! If you're unsure of anything, know that you're 💯 welcome to submit an issue or pull request on any topic. The worst that can happen is that you'll be politely directed to the best location to ask your question or to change something in your pull request. We appreciate any sort of contribution and don't want a wall of rules to get in the way of that.
Welcome to WordPress' Gutenberg project! We hope you join us in creating the future platform for publishing; all are welcome here.

As with all WordPress projects, we want to ensure a welcoming environment for everyone. With that in mind, all contributors are expected to follow our [Code of Conduct](/CODE_OF_CONDUCT.md).
## How can I contribute?

Before contributing, we encourage you to review the [Contributor Handbook](https://developer.wordpress.org/block-editor/contributors/). If you have any questions, please ask, either in Slack or open an issue in GitHub so we can help clarify.
To learn all about contributing to the Gutenberg project, see the [Contributor Guide](/docs/contributors/readme.md). The handbook includes all the details you need to get setup and start shaping the future of web publishing.

All WordPress projects are [licensed under the GPLv2+](/LICENSE.md), and all contributions to Gutenberg will be released under the GPLv2+ license. You maintain copyright over any contribution you make, and by submitting a pull request, you are agreeing to release that contribution under the GPLv2+ license.
- Code? See the [developer section](/docs/contributors/develop.md).

This document covers the technical details around setup, and submitting your contribution to the Gutenberg project.
- Design? See the [design section](/docs/contributors/design.md).

## Developer Contributions
- Documentation? See the [documentation section](/docs/contributors/document.md).

Please see the [Developer Contributions section](/docs/contributors/develop.md) of the Contributor Handbook.
- Triage? We need help reviewing existing issues to make sure they’re relevant and actionable. Triage is an important contribution because it allows us to work on the highest priority issues. To learn more, please see the [triaging issues section](docs/contributors/repository-management.md#triaging-issues).

## How Can Designers Contribute?
## Guidelines

If you'd like to contribute to the design or front-end, feel free to contribute to tickets labelled [Needs Design](https://github.com/WordPress/gutenberg/issues?q=is%3Aissue+is%3Aopen+label%3A%22Needs+Design%22) or [Needs Design Feedback](https://github.com/WordPress/gutenberg/issues?q=is%3Aissue+is%3Aopen+label%3A"Needs+Design+Feedback%22). We could use your thoughtful replies, mockups, animatics, sketches, doodles. Proposed changes are best done as minimal and specific iterations on the work that precedes it so we can compare. The [WordPress Design team](http://make.wordpress.org/design/) uses [Figma](https://www.figma.com/) to collaborate and share work. If you'd like to contribute, join the [#design channel](http://wordpress.slack.com/messages/design/) in [Slack](https://make.wordpress.org/chat/) and ask the team to set you up with a free Figma account. This will give you access to a helpful [library of components](https://www.figma.com/file/ZtN5xslEVYgzU7Dd5CxgGZwq/WordPress-Components?node-id=0%3A1) used in WordPress.
- As with all WordPress projects, we want to ensure a welcoming environment for everyone. With that in mind, all contributors are expected to follow our [Code of Conduct](/CODE_OF_CONDUCT.md).

## Triage Contributions

*Triage* is the practice of reviewing existing issues to make sure they’re relevant, actionable, and have all the information needed to reproduce and/or solve the issue. Triaging is a very important contribution because it allows the community to focus on and prioritise issues, feature proposals, discussions, and so on.

If you want to learn more about triage, and why it it important, please see the [repository management section](docs/contributors/repository-management.md#triaging-issues) of the Contributor Handbook.

## Contribute to the Documentation

Please see the [Documentation section](/docs/contributors/document.md) of the Contributor Handbook.

Documentation is automatically synced from `master` to the [Block Editor Handbook](https://developer.wordpress.org/block-editor/) every 15 minutes.

### `@wordpress/component`

If you're contributing to the documentation of any component from the `@wordpress/component` package, take a look at its [guidelines for contributing](/packages/components/CONTRIBUTING.md).
- All WordPress projects are [licensed under the GPLv2+](/LICENSE.md), and all contributions to Gutenberg will be released under the GPLv2+ license. You maintain copyright over any contribution you make, and by submitting a pull request, you are agreeing to release that contribution under the GPLv2+ license.

## Reporting Security Issues

Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,4 @@ This list is manually curated to include valuable contributions by volunteers th
| @mkevins | |
| @SergioEstevao | |
| @mzorz | @mzorz |
| @akkspros | @passoniate |
5 changes: 1 addition & 4 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ module.exports = function( api ) {

return {
presets: [ '@wordpress/babel-preset-default' ],
plugins: [
'babel-plugin-emotion',
'babel-plugin-inline-json-import',
],
plugins: [ 'babel-plugin-emotion', 'babel-plugin-inline-json-import' ],
};
};
29 changes: 19 additions & 10 deletions bin/api-docs/are-readmes-unstaged.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,26 @@ const execSync = require( 'child_process' ).execSync;
*/
const getPackages = require( './packages' );

const getUnstagedFiles = () => execSync( 'git diff --name-only', { encoding: 'utf8' } ).split( '\n' ).filter( ( element ) => '' !== element );
const readmeFiles = getPackages().map( ( [ packageName ] ) => join( 'packages', packageName, 'README.md' ) );
const unstagedReadmes = getUnstagedFiles().filter( ( element ) => readmeFiles.includes( element ) );
const getUnstagedFiles = () =>
execSync( 'git diff --name-only', { encoding: 'utf8' } )
.split( '\n' )
.filter( ( element ) => '' !== element );
const readmeFiles = getPackages().map( ( [ packageName ] ) =>
join( 'packages', packageName, 'README.md' )
);
const unstagedReadmes = getUnstagedFiles().filter( ( element ) =>
readmeFiles.includes( element )
);

if ( unstagedReadmes.length > 0 ) {
process.exitCode = 1;
process.stdout.write( chalk.red(
'\n',
'Some API docs may be out of date:',
unstagedReadmes.toString(),
'Either stage them or continue with --no-verify.',
'\n'
) );
process.stdout.write(
chalk.red(
'\n',
'Some API docs may be out of date:',
unstagedReadmes.toString(),
'Either stage them or continue with --no-verify.',
'\n'
)
);
}
12 changes: 8 additions & 4 deletions bin/api-docs/packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ const packages = [
'block-serialization-default-parser',
'blocks',
'compose',
[ 'core-data', {
'Autogenerated actions': 'src/actions.js',
'Autogenerated selectors': 'src/selectors.js',
} ],
[
'core-data',
{
'Autogenerated actions': 'src/actions.js',
'Autogenerated selectors': 'src/selectors.js',
},
],
'data',
'data-controls',
'date',
Expand All @@ -32,6 +35,7 @@ const packages = [
'shortcode',
'url',
'viewport',
'warning',
'wordcount',
];

Expand Down
Loading

0 comments on commit 30bc64c

Please sign in to comment.