Skip to content

Commit

Permalink
Merge branch 'master' into fix-7601
Browse files Browse the repository at this point in the history
# Conflicts:
#	packages/hooks/src/test/index.test.js
  • Loading branch information
Adam Silverstein committed Aug 12, 2019
2 parents bbdefa1 + 48822b9 commit 066ea32
Show file tree
Hide file tree
Showing 1,453 changed files with 63,249 additions and 25,112 deletions.
7 changes: 6 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
.cache
build
build-module
node_modules
packages/block-serialization-spec-parser/parser.js
packages/e2e-tests/plugins
playground/dist
vendor
packages/block-serialization-spec-parser/parser.js
wordpress

!.eslintrc.js
45 changes: 41 additions & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
const { escapeRegExp, map } = require( 'lodash' );
const { escapeRegExp } = require( 'lodash' );

/**
* Internal dependencies
Expand All @@ -21,7 +21,14 @@ module.exports = {
extends: [
'plugin:@wordpress/eslint-plugin/recommended',
'plugin:jest/recommended',
'plugin:eslint-comments/recommended',
],
plugins: [
'import',
],
globals: {
wp: 'off',
},
rules: {
'@wordpress/react-no-unsafe-timeout': 'error',
'no-restricted-syntax': [
Expand All @@ -33,14 +40,34 @@ module.exports = {
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: '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.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=/^(__|_x|_n|_nx)$/] Literal[value=/\\.{3}/]',
message: 'Use ellipsis character (…) in place of three dots',
},
{
selector: 'ImportDeclaration[source.value="redux"] Identifier.imported[name="combineReducers"]',
message: 'Use `combineReducers` from `@wordpress/data`',
},
{
selector: 'ImportDeclaration[source.value="lodash"] Identifier.imported[name="memoize"]',
message: 'Use memize instead of Lodash’s memoize',
Expand Down Expand Up @@ -86,15 +113,25 @@ module.exports = {
} ],
},
overrides: [
{
files: [ 'packages/**/*.js' ],
rules: {
'import/no-extraneous-dependencies': 'error',
},
excludedFiles: [
'**/*.@(android|ios|native).js',
'**/@(benchmark|test|__tests__)/**/*.js',
],
},
{
files: [ 'packages/e2e-test*/**/*.js' ],
env: {
browser: true,
},
globals: {
browser: true,
page: true,
wp: true,
browser: 'readonly',
page: 'readonly',
wp: 'readonly',
},
},
],
Expand Down
128 changes: 64 additions & 64 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,89 +1,89 @@
# Documentation
/docs @youknowriad @chrisvanpatten @mkaz @ajitbohra @nosolosw @notnownikki
/docs/designers-developers/developers @youknowriad @gziolo @chrisvanpatten @mkaz @ajitbohra @nosolosw @notnownikki
/docs/designers-developers/designers @youknowriad @chrisvanpatten @mkaz @ajitbohra @nosolosw @notnownikki
/docs @chrisvanpatten @ajitbohra
/docs/designers-developers/developers @youknowriad @chrisvanpatten @mkaz @ajitbohra
/docs/designers-developers/designers @chrisvanpatten @mkaz @ajitbohra

# Data
/packages/api-fetch @youknowriad @aduth @nerrad @mmtr
/packages/core-data @youknowriad @gziolo @aduth @nerrad @noisysocks
/packages/data @youknowriad @aduth @nerrad @coderkevin
/packages/redux-routine @youknowriad @aduth @nerrad
/packages/api-fetch @youknowriad @nerrad @mmtr
/packages/core-data @youknowriad @nerrad
/packages/data @youknowriad @nerrad @coderkevin
/packages/redux-routine @youknowriad @nerrad

# Blocks
/packages/block-library @youknowriad @gziolo @Soean @ajitbohra @jorgefilipecosta @talldan @noisysocks @notnownikki
/packages/block-library @Soean @ajitbohra @jorgefilipecosta @talldan

# Editor
/packages/annotations @youknowriad @aduth @atimmer @ellatrix
/packages/autop @youknowriad @aduth
/packages/block-editor @youknowriad @gziolo @talldan @noisysocks @ellatrix
/packages/block-serialization-spec-parser @youknowriad @gziolo @aduth @dmsnell
/packages/block-serialization-default-parser @youknowriad @gziolo @aduth @dmsnell
/packages/blocks @youknowriad @gziolo @aduth @noisysocks @ellatrix
/packages/edit-post @youknowriad @talldan @noisysocks
/packages/editor @youknowriad @talldan @noisysocks
/packages/list-reusable-blocks @youknowriad @aduth @noisysocks
/packages/shortcode @youknowriad @aduth
/packages/annotations @atimmer @ellatrix
/packages/autop @aduth
/packages/block-editor @youknowriad @talldan @ellatrix
/packages/block-serialization-spec-parser @dmsnell
/packages/block-serialization-default-parser @dmsnell
/packages/blocks @youknowriad @gziolo @ellatrix
/packages/edit-post @talldan
/packages/editor @talldan
/packages/list-reusable-blocks @youknowriad @noisysocks
/packages/shortcode @aduth

# Widgets
/packages/edit-widgets @youknowriad

# Tooling
/bin @youknowriad @gziolo @aduth @ntwb @nerrad @ajitbohra
/docs/tool @youknowriad @gziolo @chrisvanpatten @mkaz @ajitbohra @nosolosw @notnownikki
/packages/babel-plugin-import-jsx-pragma @youknowriad @gziolo @aduth @ntwb @nerrad @ajitbohra @nosolosw
/packages/babel-plugin-makepot @youknowriad @gziolo @aduth @ntwb @nerrad @ajitbohra
/packages/babel-preset-default @youknowriad @gziolo @aduth @ntwb @nerrad @ajitbohra @nosolosw
/packages/browserslist-config @youknowriad @gziolo @aduth @ntwb @nerrad @ajitbohra
/packages/custom-templated-path-webpack-plugin @youknowriad @gziolo @aduth @ntwb @nerrad @ajitbohra
/packages/docgen @nosolosw @mkaz @gziolo
/packages/e2e-test-utils @youknowriad @gziolo @aduth @ntwb @nerrad @ajitbohra
/packages/e2e-tests @youknowriad @gziolo @aduth @ntwb @nerrad @ajitbohra @talldan
/packages/eslint-plugin @youknowriad @gziolo @aduth @ntwb @nerrad @ajitbohra @nosolosw
/packages/jest-console @youknowriad @gziolo @aduth @ntwb @nerrad @ajitbohra
/packages/jest-preset-default @youknowriad @gziolo @aduth @ntwb @nerrad @ajitbohra
/packages/jest-puppeteer-axe @youknowriad @gziolo @aduth @ntwb @nerrad @ajitbohra
/packages/library-export-default-webpack-plugin @youknowriad @gziolo @aduth @ntwb @nerrad @ajitbohra
/packages/npm-package-json-lint-config @youknowriad @gziolo @aduth @ntwb @nerrad @ajitbohra
/packages/postcss-themes @youknowriad @gziolo @aduth @ntwb @nerrad @ajitbohra
/packages/scripts @youknowriad @gziolo @aduth @ntwb @nerrad @ajitbohra @nosolosw @mkaz
/bin @ntwb @nerrad @ajitbohra
/bin/update-readmes.js @ntwb @nerrad @ajitbohra @nosolosw
/docs/tool @youknowriad @chrisvanpatten @ajitbohra @nosolosw
/packages/babel-plugin-import-jsx-pragma @gziolo @ntwb @nerrad @ajitbohra
/packages/babel-plugin-makepot @ntwb @nerrad @ajitbohra
/packages/babel-preset-default @youknowriad @gziolo @ntwb @nerrad @ajitbohra
/packages/browserslist-config @gziolo @ntwb @nerrad @ajitbohra
/packages/custom-templated-path-webpack-plugin @ntwb @nerrad @ajitbohra
/packages/docgen @nosolosw
/packages/e2e-test-utils @gziolo @ntwb @nerrad @ajitbohra
/packages/e2e-tests @gziolo @ntwb @nerrad @ajitbohra @talldan
/packages/eslint-plugin @gziolo @ntwb @nerrad @ajitbohra
/packages/jest-console @gziolo @ntwb @nerrad @ajitbohra
/packages/jest-preset-default @gziolo @ntwb @nerrad @ajitbohra
/packages/jest-puppeteer-axe @gziolo @ntwb @nerrad @ajitbohra
/packages/library-export-default-webpack-plugin @gziolo @ntwb @nerrad @ajitbohra
/packages/npm-package-json-lint-config @gziolo @ntwb @nerrad @ajitbohra
/packages/postcss-themes @youknowriad @ntwb @nerrad @ajitbohra
/packages/scripts @youknowriad @gziolo @ntwb @nerrad @ajitbohra @nosolosw

# UI Components
/packages/components @youknowriad @gziolo @aduth @ajitbohra @jaymanpandya @jorgefilipecosta @talldan @noisysocks @chrisvanpatten
/packages/compose @youknowriad @gziolo @aduth @ajitbohra @jaymanpandya @jorgefilipecosta @talldan @noisysocks
/packages/element @youknowriad @gziolo @aduth @ajitbohra @jaymanpandya @jorgefilipecosta @talldan @noisysocks
/packages/notices @youknowriad @gziolo @aduth @ajitbohra @jaymanpandya @jorgefilipecosta @talldan @noisysocks
/packages/nux @youknowriad @gziolo @aduth @ajitbohra @jaymanpandya @jorgefilipecosta @talldan @noisysocks
/packages/viewport @youknowriad @gziolo @aduth @ajitbohra @jaymanpandya @jorgefilipecosta @talldan @noisysocks
/packages/components @youknowriad @gziolo @ajitbohra @jaymanpandya @jorgefilipecosta @talldan @chrisvanpatten
/packages/compose @youknowriad @gziolo @ajitbohra @jaymanpandya @jorgefilipecosta @talldan
/packages/element @youknowriad @gziolo @ajitbohra @jaymanpandya @jorgefilipecosta @talldan
/packages/notices @ajitbohra @jaymanpandya @jorgefilipecosta @talldan
/packages/nux @ajitbohra @jaymanpandya @jorgefilipecosta @talldan @noisysocks
/packages/viewport @youknowriad @ajitbohra @jaymanpandya @jorgefilipecosta @talldan

# Utilities
/packages/a11y @youknowriad @gziolo @aduth
/packages/blob @youknowriad @gziolo @aduth
/packages/date @youknowriad @gziolo @aduth
/packages/deprecated @youknowriad @gziolo @aduth
/packages/dom @youknowriad @gziolo @aduth @nosolosw @ellatrix
/packages/dom-ready @youknowriad @gziolo @aduth
/packages/escape-html @youknowriad @gziolo @aduth
/packages/html-entities @youknowriad @gziolo @aduth
/packages/i18n @youknowriad @aduth @swissspidy
/packages/is-shallow-equal @youknowriad @gziolo @aduth
/packages/keycodes @youknowriad @gziolo @aduth @talldan @ellatrix
/packages/priority-queue @youknowriad @gziolo @aduth
/packages/token-list @youknowriad @gziolo @aduth
/packages/url @youknowriad @gziolo @aduth @talldan
/packages/wordcount @youknowriad @gziolo @aduth
/packages/a11y @youknowriad @aduth
/packages/blob @aduth
/packages/date @aduth
/packages/deprecated @aduth
/packages/dom @ellatrix
/packages/dom-ready @aduth
/packages/escape-html @aduth
/packages/html-entities @aduth
/packages/i18n @swissspidy
/packages/is-shallow-equal @aduth
/packages/keycodes @talldan @ellatrix
/packages/priority-queue @youknowriad @aduth
/packages/token-list @aduth
/packages/url @talldan
/packages/wordcount @aduth

# Extensibility
/packages/hooks @youknowriad @gziolo @aduth @adamsilverstein
/packages/plugins @youknowriad @gziolo @aduth @adamsilverstein
/packages/hooks @gziolo @adamsilverstein
/packages/plugins @gziolo @adamsilverstein

# Rich Text
/packages/format-library @youknowriad @aduth @ellatrix @jorgefilipecosta
/packages/rich-text @youknowriad @aduth @ellatrix @jorgefilipecosta
/packages/block-editor/src/components/rich-text @youknowriad @aduth @ellatrix @jorgefilipecosta
/packages/format-library @ellatrix @jorgefilipecosta @daniloercoli @sergioestevao @etoledom
/packages/rich-text @ellatrix @jorgefilipecosta @daniloercoli @sergioestevao @etoledom
/packages/block-editor/src/components/rich-text @ellatrix @jorgefilipecosta @daniloercoli @sergioestevao @etoledom

# PHP
/lib @youknowriad @gziolo @aduth
*-controller.php @youknowriad @gziolo @aduth @timothybjacobs
/lib @timothybjacobs

# Native (Unowned)
*.native.js @ghost
Expand Down
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
- [ ] My code follows the WordPress code style. <!-- Check code: `npm run lint`, Guidelines: https://make.wordpress.org/core/handbook/best-practices/coding-standards/javascript/ -->
- [ ] My code follows the accessibility standards. <!-- Guidelines: https://make.wordpress.org/core/handbook/best-practices/coding-standards/accessibility-coding-standards/ -->
- [ ] My code has proper inline documentation. <!-- Guidelines: https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/javascript/ -->
- [ ] I've included developer documentation if appropriate. <!-- Handbook: https://wordpress.org/gutenberg/handbook/designers-developers/ -->
- [ ] I've included developer documentation if appropriate. <!-- Handbook: https://developer.wordpress.org/block-editor/ -->
18 changes: 18 additions & 0 deletions .github/actions/assign-fixed-issues/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM debian:stable-slim

LABEL "name"="Assign Fixed Issues"
LABEL "maintainer"="The WordPress Contributors"
LABEL "version"="1.0.0"

LABEL "com.github.actions.name"="Assign Fixed Issues"
LABEL "com.github.actions.description"="Assigns the issues fixed by a pull request to the author of that pull request"
LABEL "com.github.actions.icon"="flag"
LABEL "com.github.actions.color"="green"

RUN apt-get update && \
apt-get install --no-install-recommends -y jq curl ca-certificates && \
apt-get clean -y

COPY entrypoint.sh /entrypoint.sh

ENTRYPOINT [ "/entrypoint.sh" ]
51 changes: 51 additions & 0 deletions .github/actions/assign-fixed-issues/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash
set -e

# 1. Find the issues that this PR 'fixes'.

issues=$(
jq -r '.pull_request.body' $GITHUB_EVENT_PATH | perl -nle 'print $1 while /
(?:close|closes|closed|fix|fixes|fixed|resolve|resolves|resolved)
:?
\ +
(?:\#?|https?:\/\/github\.com\/WordPress\/gutenberg\/issues\/)
(\d+)
/igx'
)

if [ -z "$issues" ]; then
echo "Pull request does not 'fix' any issues. Aborting."
exit 78
fi

# 2. Grab the author of the PR.

author=$(jq -r '.pull_request.user.login' $GITHUB_EVENT_PATH)

# 3. Loop through each 'fixed' issue.

for issue in $issues; do

# 3a. Add the author as an asignee to the issue. This fails if the author is
# already assigned, which is expected and ignored.

curl \
--silent \
-X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"assignees\":[\"$author\"]}" \
"https://api.github.com/repos/$GITHUB_REPOSITORY/issues/$issue/assignees" > /dev/null

# 3b. Label the issue as 'In Progress'. This fails if the label is already
# applied, which is expected and ignored.

curl \
--silent \
-X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/json" \
-d '{"labels":["[Status] In Progress"]}' \
"https://api.github.com/repos/$GITHUB_REPOSITORY/issues/$issue/labels" > /dev/null

done
18 changes: 18 additions & 0 deletions .github/actions/first-time-contributor/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM debian:stable-slim

LABEL "name"="First Time Contributor"
LABEL "maintainer"="The WordPress Contributors"
LABEL "version"="1.0.0"

LABEL "com.github.actions.name"="First Time Contributor"
LABEL "com.github.actions.description"="Assigns the first time contributor label to pull requests"
LABEL "com.github.actions.icon"="award"
LABEL "com.github.actions.color"="green"

RUN apt-get update && \
apt-get install --no-install-recommends -y jq curl ca-certificates && \
apt-get clean -y

COPY entrypoint.sh /entrypoint.sh

ENTRYPOINT [ "/entrypoint.sh" ]
35 changes: 35 additions & 0 deletions .github/actions/first-time-contributor/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash
set -e

# 1. Get the author and pr number for the pull request.
author=$(jq -r '.pull_request.user.login' $GITHUB_EVENT_PATH)
pr_number=$(jq -r '.number' $GITHUB_EVENT_PATH)

if [ "$pr_number" = "null" ] || [ "$author" = "null" ]; then
echo "Could not find PR number or author. $pr_number / $author"
exit 78
fi

# 2. Fetch the author's commit count for the repo to determine if they're a first-time contributor.
commit_count=$(
curl \
--silent \
-H "Accept: application/vnd.github.cloak-preview" \
"https://api.github.com/search/commits?q=repo:$GITHUB_REPOSITORY+author:$author" \
| jq -r '.total_count'
)

# 3. If the response has a commit count of zero, exit early, the author is not a first time contributor.
if [ "$commit_count" != "0" ]; then
echo "Pull request #$pr_number was not created by a first-time contributor ($author)."
exit 78
fi

# 4. Assign the 'First Time Contributor' label.
curl \
--silent \
-X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/json" \
-d '{"labels":["First-time Contributor"]}' \
"https://api.github.com/repos/$GITHUB_REPOSITORY/issues/$pr_number/labels" > /dev/null
Loading

0 comments on commit 066ea32

Please sign in to comment.