diff --git a/.editorconfig b/.editorconfig index 0cdfc80277e88..5987f2667d470 100644 --- a/.editorconfig +++ b/.editorconfig @@ -13,6 +13,10 @@ insert_final_newline = true trim_trailing_whitespace = true indent_style = tab +[*.{yml,yaml}] +indent_style = space +indent_size = 2 + [*.{gradle,java,kt}] indent_style = space diff --git a/.eslintrc.js b/.eslintrc.js index 2563edaafd004..22c354394d00a 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -26,8 +26,8 @@ const majorMinorRegExp = */ const developmentFiles = [ '**/benchmark/**/*.js', - '**/@(__mocks__|__tests__|test)/**/*.js', - '**/@(storybook|stories)/**/*.js', + '**/@(__mocks__|__tests__|test)/**/*.[tj]s?(x)', + '**/@(storybook|stories)/**/*.[tj]s?(x)', 'packages/babel-preset-default/bin/**/*.js', ]; @@ -49,12 +49,13 @@ module.exports = { jsdoc: { mode: 'typescript', }, + 'import/internal-regex': null, 'import/resolver': require.resolve( './tools/eslint/import-resolver' ), }, rules: { 'jest/expect-expect': 'off', '@wordpress/dependency-group': 'error', - '@wordpress/gutenberg-phase': 'error', + '@wordpress/is-gutenberg-plugin': 'error', '@wordpress/react-no-unsafe-timeout': 'error', '@wordpress/i18n-text-domain': [ 'error', @@ -70,16 +71,16 @@ module.exports = { 'error', { paths: [ + { + name: 'framer-motion', + message: + 'Please use the Framer Motion API through `@wordpress/components` instead.', + }, { name: 'lodash', importNames: [ 'memoize' ], message: 'Please use `memize` instead.', }, - { - name: 'react', - message: - 'Please use React API through `@wordpress/element` instead.', - }, { name: 'reakit', message: @@ -99,7 +100,20 @@ module.exports = { { name: '@emotion/css', message: - 'Please use `@emotion/react` and `@emotion/styled` in order to maintain iframe support', + 'Please use `@emotion/react` and `@emotion/styled` in order to maintain iframe support. As a replacement for the `cx` function, please use the `useCx` hook defined in `@wordpress/components` instead.', + }, + ], + }, + ], + '@typescript-eslint/no-restricted-imports': [ + 'error', + { + paths: [ + { + name: 'react', + message: + 'Please use React API through `@wordpress/element` instead.', + allowTypeImports: true, }, ], }, @@ -115,12 +129,6 @@ module.exports = { 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=/' + @@ -176,6 +184,7 @@ module.exports = { ...developmentFiles, ], rules: { + 'import/default': 'off', 'import/no-extraneous-dependencies': 'off', 'import/no-unresolved': 'off', 'import/named': 'off', @@ -185,7 +194,7 @@ module.exports = { { files: [ 'packages/react-native-*/**/*.js' ], settings: { - 'import/ignore': [ 'react-native' ], // Workaround for https://github.com/facebook/react-native/issues/28549 + 'import/ignore': [ 'react-native' ], // Workaround for https://github.com/facebook/react-native/issues/28549. }, }, { @@ -216,16 +225,47 @@ module.exports = { }, }, { - files: [ 'packages/jest*/**/*.js' ], + files: [ 'packages/jest*/**/*.js', '**/test/**/*.js' ], + excludedFiles: [ 'test/e2e/**/*.js' ], extends: [ 'plugin:@wordpress/eslint-plugin/test-unit' ], }, { files: [ 'packages/e2e-test*/**/*.js' ], + excludedFiles: [ 'packages/e2e-test-utils-playwright/**/*.js' ], extends: [ 'plugin:@wordpress/eslint-plugin/test-e2e' ], rules: { 'jest/expect-expect': 'off', }, }, + { + files: [ + 'test/e2e/**/*.[tj]s', + 'packages/e2e-test-utils-playwright/**/*.[tj]s', + ], + extends: [ 'plugin:eslint-plugin-playwright/playwright-test' ], + rules: { + '@wordpress/no-global-active-element': 'off', + '@wordpress/no-global-get-selection': 'off', + 'no-restricted-syntax': [ + 'error', + { + selector: 'CallExpression[callee.property.name="$"]', + message: + '`$` is discouraged, please use `locator` instead', + }, + { + selector: 'CallExpression[callee.property.name="$$"]', + message: + '`$$` is discouraged, please use `locator` instead', + }, + { + selector: + 'CallExpression[callee.object.name="page"][callee.property.name="waitForTimeout"]', + message: 'Prefer page.locator instead.', + }, + ], + }, + }, { files: [ 'bin/**/*.js', 'packages/env/**' ], rules: { @@ -239,5 +279,16 @@ module.exports = { 'jsdoc/valid-types': 'off', }, }, + { + files: [ + '**/@(storybook|stories)/*', + 'packages/components/src/**/*.tsx', + ], + rules: { + // Useful to add story descriptions via JSDoc without specifying params, + // or in TypeScript files where params are likely already documented outside of the JSDoc. + 'jsdoc/require-param': 'off', + }, + }, ], }; diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 0000000000000..1f31dda7e1826 --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,5 @@ +# Set line width to 80. +4857ad58c1241b3d63d21a6880c989b85746c3dc + +# ESLint updates. +f63053cace3c02e284f00918e1854284c85b9132 diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index cd63087b8124c..2c588ae6adcc3 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,20 +1,26 @@ # Documentation -/docs @chrisvanpatten @ajitbohra -/docs/designers-developers/developers @chrisvanpatten @mkaz @ajitbohra -/docs/designers-developers/designers @chrisvanpatten @mkaz @ajitbohra +/docs @ajitbohra @ryanwelcher @juanmaguitar @fabiankaegy + +# Schemas +/schemas/json @ajlende # Data /packages/api-fetch @nerrad @mmtr /packages/core-data @nerrad -/packages/data @nerrad @coderkevin +/packages/data @nerrad /packages/redux-routine @nerrad /packages/data-controls @nerrad # Blocks /packages/block-library @ajitbohra -/packages/block-library/src/gallery @mkevins -/packages/block-library/src/social-links @mkaz -/packages/block-library/src/social-link @mkaz +/packages/block-library/src/gallery @geriux +/packages/block-library/src/navigation @tellthemachines +/packages/block-library/src/navigation-link @tellthemachines +/packages/block-library/src/navigation-submenu @tellthemachines +/packages/block-library/src/page-list @tellthemachines +/packages/block-library/src/comment-template @michalczaplinski +/packages/block-library/src/comments @michalczaplinski +/packages/block-library/src/table-of-contents @ZebulanStanphill # Duotone /lib/block-supports/duotone.php @ajlende @@ -31,6 +37,7 @@ /packages/blocks /packages/edit-post /packages/editor +/packages/editor/src/components/post-title @alexstine /packages/list-reusable-blocks /packages/shortcode /packages/block-directory @@ -40,26 +47,28 @@ # Widgets /packages/edit-widgets @draganescu @talldan @noisysocks @tellthemachines @adamziel @kevin940726 +/packages/customize-widgets @noisysocks +/packages/widgets @noisysocks # Navigation -/packages/edit-navigation @draganescu @talldan @noisysocks @tellthemachines @adamziel @kevin940726 @getdave +/packages/edit-navigation @draganescu @talldan @tellthemachines @adamziel @kevin940726 @getdave # Full Site Editing /packages/edit-site # Tooling /bin @ntwb @nerrad @ajitbohra -/bin/api-docs @ntwb @nerrad @ajitbohra @nosolosw -/docs/tool @chrisvanpatten @ajitbohra @nosolosw +/bin/api-docs @ntwb @nerrad @ajitbohra +/docs/tool @ajitbohra /packages/babel-plugin-import-jsx-pragma @ntwb @nerrad @ajitbohra /packages/babel-plugin-makepot @ntwb @nerrad @ajitbohra /packages/babel-preset-default @gziolo @ntwb @nerrad @ajitbohra /packages/browserslist-config @ntwb @nerrad @ajitbohra -/packages/create-block @gziolo @mkaz -/packages/create-block-tutorial-template @gziolo +/packages/create-block @gziolo @ryanwelcher +/packages/create-block-tutorial-template @gziolo @ryanwelcher /packages/custom-templated-path-webpack-plugin @ntwb @nerrad @ajitbohra /packages/dependency-extraction-webpack-plugin @gziolo -/packages/docgen @nosolosw +/packages/docgen /packages/e2e-test-utils @ntwb @nerrad @ajitbohra /packages/e2e-tests @ntwb @nerrad @ajitbohra /packages/eslint-plugin @gziolo @ntwb @nerrad @ajitbohra @@ -70,16 +79,16 @@ /packages/npm-package-json-lint-config @gziolo @ntwb @nerrad @ajitbohra /packages/postcss-themes @ntwb @nerrad @ajitbohra /packages/prettier-config @ntwb @gziolo -/packages/scripts @gziolo @ntwb @nerrad @ajitbohra +/packages/scripts @gziolo @ntwb @nerrad @ajitbohra @ryanwelcher /packages/stylelint-config @ntwb # UI Components -/packages/components @ajitbohra @jaymanpandya @chrisvanpatten -/packages/compose @ajitbohra @jaymanpandya -/packages/element @ajitbohra @jaymanpandya -/packages/notices @ajitbohra @jaymanpandya -/packages/nux @ajitbohra @jaymanpandya -/packages/viewport @ajitbohra @jaymanpandya +/packages/components @ajitbohra +/packages/compose @ajitbohra +/packages/element @ajitbohra +/packages/notices @ajitbohra +/packages/nux @ajitbohra +/packages/viewport @ajitbohra /packages/base-styles /packages/icons /packages/primitives @@ -95,22 +104,23 @@ /packages/html-entities /packages/i18n @swissspidy /packages/is-shallow-equal +/packages/keyboard-shortcuts /packages/keycodes +/packages/preferences @talldan /packages/priority-queue /packages/token-list /packages/url /packages/wordcount /packages/warning -/packages/keyboard-shortcuts # Extensibility /packages/hooks @adamsilverstein /packages/plugins @gziolo @adamsilverstein # Rich Text -/packages/format-library @ellatrix @cameronvoell @guarani -/packages/rich-text @ellatrix @cameronvoell @guarani -/packages/block-editor/src/components/rich-text @ellatrix @cameronvoell @guarani +/packages/format-library @ellatrix @fluiddot +/packages/rich-text @ellatrix @fluiddot +/packages/block-editor/src/components/rich-text @ellatrix @fluiddot # Project Management /.github @@ -120,22 +130,16 @@ /packages/env @noahtallen # PHP -/lib @timothybjacobs @spacedmonkey -/lib/global-styles.php @timothybjabocs @spacedmonkey @nosolosw -/lib/experimental-default-theme.json @timothybjabocs @spacedmonkey @nosolosw -/lib/class-wp-theme-json-gutenberg.php @timothybjabocs @spacedmonkey @nosolosw -/lib/class-wp-theme-json-resolver-gutenberg.php @timothybjabocs @spacedmonkey @nosolosw -/phpunit/class-wp-theme-json-test.php @nosolosw - -# Web App -/packages/admin-manifest @ellatrix -/lib/pwa.php @ellatrix -/lib/service-worker.js @ellatrix +/lib @timothybjacobs @spacedmonkey +/lib/experimental/class-wp-rest-block-editor-settings-controller.php @timothybjacobs @spacedmonkey @geriux + +# Native +/packages/components/src/mobile/global-styles-context @geriux # Native (Unowned) -*.native.js @ghost -*.android.js @ghost -*.ios.js @ghost -*.native.scss @ghost -*.android.scss @ghost -*.ios.scss @ghost +*.native.js +*.android.js +*.ios.js +*.native.scss +*.android.scss +*.ios.scss diff --git a/.github/ISSUE_TEMPLATE/Bug_report.yml b/.github/ISSUE_TEMPLATE/Bug_report.yml index b116dbec7f06a..ab001b41ff793 100644 --- a/.github/ISSUE_TEMPLATE/Bug_report.yml +++ b/.github/ISSUE_TEMPLATE/Bug_report.yml @@ -1,127 +1,72 @@ name: Bug report description: Report a bug with the WordPress block editor or Gutenberg plugin -title: "
${ getHeadBranch() }
.
+