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

Eslint: Add rule to prohibit unsafe APIs #27301

Merged
merged 15 commits into from
Nov 27, 2020
Merged

Conversation

sirreal
Copy link
Member

@sirreal sirreal commented Nov 26, 2020

Description

Add a rule @wordpress/no-unsafe-wp-apis to prohibit usage of __unsafe and __experimental exported names from @wordpress/* packages. Usage of these features is discouraged.

See the included documentation.

Limitations: This is limited to imported names from @wordpress/* modules. This covers some of the features, but will not prevent usage of experimental or unstable APIs that do not appear as imported names. For example, this would not cover component properties like <MyComponent __experimentalProp={ true } />.

Todo:

  • Unstable names should probably be configurable as well
  • Disable for Gutenenberg
  • Add changelog

How has this been tested?

Includes tests.

Types of changes

New feature: Add @wordpress/no-unsafe-wp-apis to discourage use of experimental and unstable features.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR.

@sirreal sirreal self-assigned this Nov 26, 2020
@sirreal sirreal added [Tool] ESLint plugin /packages/eslint-plugin npm Packages Related to npm packages [Type] Enhancement A suggestion for improvement. labels Nov 26, 2020
@sirreal sirreal requested a review from gziolo November 26, 2020 13:40
@github-actions
Copy link

github-actions bot commented Nov 26, 2020

Size Change: +42 B (0%)

Total Size: 1.2 MB

Filename Size Change
build/block-library/editor-rtl.css 8.95 kB -15 B (0%)
build/block-library/editor.css 8.95 kB -15 B (0%)
build/block-library/index.js 148 kB -14 B (0%)
build/block-library/style-rtl.css 8.27 kB +39 B (0%)
build/block-library/style.css 8.27 kB +39 B (0%)
build/block-library/theme-rtl.css 789 B -3 B (0%)
build/block-library/theme.css 790 B -3 B (0%)
build/components/index.js 172 kB +5 B (0%)
build/edit-navigation/index.js 11.1 kB +9 B (0%)
ℹ️ View Unchanged
Filename Size Change
build/a11y/index.js 1.14 kB 0 B
build/annotations/index.js 3.8 kB 0 B
build/api-fetch/index.js 3.42 kB 0 B
build/autop/index.js 2.84 kB 0 B
build/blob/index.js 664 B 0 B
build/block-directory/index.js 8.72 kB 0 B
build/block-directory/style-rtl.css 943 B 0 B
build/block-directory/style.css 942 B 0 B
build/block-editor/index.js 134 kB 0 B
build/block-editor/style-rtl.css 11.3 kB 0 B
build/block-editor/style.css 11.3 kB 0 B
build/block-serialization-default-parser/index.js 1.87 kB 0 B
build/block-serialization-spec-parser/index.js 3.06 kB 0 B
build/blocks/index.js 48.1 kB 0 B
build/components/style-rtl.css 15.3 kB 0 B
build/components/style.css 15.3 kB 0 B
build/compose/index.js 9.95 kB 0 B
build/core-data/index.js 14.8 kB 0 B
build/data-controls/index.js 828 B 0 B
build/data/index.js 8.8 kB 0 B
build/date/index.js 11.2 kB 0 B
build/deprecated/index.js 768 B 0 B
build/dom-ready/index.js 571 B 0 B
build/dom/index.js 4.95 kB 0 B
build/edit-navigation/style-rtl.css 881 B 0 B
build/edit-navigation/style.css 885 B 0 B
build/edit-post/index.js 306 kB 0 B
build/edit-post/style-rtl.css 6.42 kB 0 B
build/edit-post/style.css 6.4 kB 0 B
build/edit-site/index.js 24 kB 0 B
build/edit-site/style-rtl.css 3.92 kB 0 B
build/edit-site/style.css 3.92 kB 0 B
build/edit-widgets/index.js 26.3 kB 0 B
build/edit-widgets/style-rtl.css 3.13 kB 0 B
build/edit-widgets/style.css 3.13 kB 0 B
build/editor/editor-styles-rtl.css 476 B 0 B
build/editor/editor-styles.css 478 B 0 B
build/editor/index.js 43.3 kB 0 B
build/editor/style-rtl.css 3.85 kB 0 B
build/editor/style.css 3.85 kB 0 B
build/element/index.js 4.62 kB 0 B
build/escape-html/index.js 735 B 0 B
build/format-library/index.js 6.87 kB 0 B
build/format-library/style-rtl.css 547 B 0 B
build/format-library/style.css 548 B 0 B
build/hooks/index.js 2.27 kB 0 B
build/html-entities/index.js 623 B 0 B
build/i18n/index.js 3.57 kB 0 B
build/is-shallow-equal/index.js 698 B 0 B
build/keyboard-shortcuts/index.js 2.54 kB 0 B
build/keycodes/index.js 1.94 kB 0 B
build/list-reusable-blocks/index.js 3.1 kB 0 B
build/list-reusable-blocks/style-rtl.css 476 B 0 B
build/list-reusable-blocks/style.css 476 B 0 B
build/media-utils/index.js 5.32 kB 0 B
build/notices/index.js 1.81 kB 0 B
build/nux/index.js 3.42 kB 0 B
build/nux/style-rtl.css 671 B 0 B
build/nux/style.css 668 B 0 B
build/plugins/index.js 2.56 kB 0 B
build/primitives/index.js 1.43 kB 0 B
build/priority-queue/index.js 790 B 0 B
build/redux-routine/index.js 2.84 kB 0 B
build/reusable-blocks/index.js 2.92 kB 0 B
build/rich-text/index.js 13.3 kB 0 B
build/server-side-render/index.js 2.77 kB 0 B
build/shortcode/index.js 1.69 kB 0 B
build/token-list/index.js 1.27 kB 0 B
build/url/index.js 4.06 kB 0 B
build/viewport/index.js 1.86 kB 0 B
build/warning/index.js 1.14 kB 0 B
build/wordcount/index.js 1.22 kB 0 B

compressed-size-action

@sirreal
Copy link
Member Author

sirreal commented Nov 26, 2020

Example output from Gutenberg (npm run lint-js) without the rule disabled:

lint results
gutenberg/bin/plugin/commands/performance.js
  182:0  warning  Expected @param names to be "branches, options". Got "options, branches"  jsdoc/check-param-names

gutenberg/packages/block-directory/src/plugins/inserter-menu-downloadable-blocks-panel/index.js
  9:10  error  Usage of `__experimentalInserterMenuExtension` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-editor/src/autocompleters/block.js
  32:0  warning  @param "props" does not match an existing function parameter  jsdoc/check-param-names

gutenberg/packages/block-editor/src/components/block-alignment-matrix-toolbar/index.js
  14:2  error  Usage of `__experimentalAlignmentMatrixControl` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-editor/src/components/block-controls/index.js
  11:2  error  Usage of `__experimentalToolbarContext` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-editor/src/components/block-format-controls/index.js
  11:2  error  Usage of `__experimentalToolbarContext` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-editor/src/components/block-inspector/index.js
  12:2  error  Usage of `__experimentalUseSlot` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-editor/src/components/block-list/block-selection-button.js
  15:2  error  Usage of `__experimentalGetAccessibleBlockLabel` from `@wordpress/blocks` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-editor/src/components/block-list/block-wrapper.js
  22:10  error  Usage of `__unstableGetBlockProps` from `@wordpress/blocks` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-editor/src/components/block-list/block-wrapper.native.js
  4:10  error  Usage of `__unstableGetBlockProps` from `@wordpress/blocks` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-editor/src/components/block-list/block.native.js
  19:2   error  Usage of `__experimentalGetAccessibleBlockLabel` from `@wordpress/blocks` is not allowed  @wordpress/no-unsafe-wp-apis
  21:10  error  Usage of `__experimentalUseEditorFeature` from `@wordpress/block-editor` is not allowed   @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-editor/src/components/block-navigation/appender.js
  9:10  error  Usage of `__experimentalTreeGridCell` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-editor/src/components/block-navigation/block-select-button.js
  10:2  error  Usage of `__experimentalGetBlockLabel` from `@wordpress/blocks` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-editor/src/components/block-navigation/block.js
  10:2  error  Usage of `__experimentalTreeGridCell` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis
  11:2  error  Usage of `__experimentalTreeGridItem` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-editor/src/components/block-navigation/leaf.js
  10:10  error  Usage of `__experimentalTreeGridRow` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-editor/src/components/block-navigation/list-item.js
  11:2  error  Usage of `__experimentalGetBlockLabel` from `@wordpress/blocks` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-editor/src/components/block-navigation/tree.js
  5:10  error  Usage of `__experimentalTreeGrid` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-editor/src/components/block-navigation/use-block-navigation-drop-zone.js
  4:10  error  Usage of `__unstableUseDropZone` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-editor/src/components/block-title/index.js
  12:2  error  Usage of `__experimentalGetBlockLabel` from `@wordpress/blocks` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-editor/src/components/colors-gradients/control.js
  17:2  error  Usage of `__experimentalGradientPicker` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-editor/src/components/gradient-picker/index.js
  4:10  error  Usage of `__experimentalGradientPicker` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-editor/src/components/rich-text/index.js
  27:2  error  Usage of `__experimentalRichText` from `@wordpress/rich-text` is not allowed         @wordpress/no-unsafe-wp-apis
  28:2  error  Usage of `__unstableCreateElement` from `@wordpress/rich-text` is not allowed        @wordpress/no-unsafe-wp-apis
  30:2  error  Usage of `__unstableIsEmptyLine` from `@wordpress/rich-text` is not allowed          @wordpress/no-unsafe-wp-apis
  32:2  error  Usage of `__unstableInsertLineSeparator` from `@wordpress/rich-text` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-editor/src/components/rich-text/input-event.js
  20:3  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener
  24:3  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener

gutenberg/packages/block-editor/src/components/unit-control/index.js
  4:10  error  Usage of `__experimentalUnitControl` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-editor/src/components/use-block-drop-zone/index.js
  4:10  error  Usage of `__unstableUseDropZone` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-editor/src/components/use-resize-canvas/index.js
  27:3  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener
  30:4  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener

gutenberg/packages/block-editor/src/hooks/padding.js
  7:10  error  Usage of `__experimentalBoxControl` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-library/src/button/color-edit.js
  20:2  error  Usage of `__experimentalPanelColorGradientSettings` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis
  23:2  error  Usage of `__experimentalUseEditorFeature` from `@wordpress/block-editor` is not allowed            @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-library/src/button/color-props.js
  12:2  error  Usage of `__experimentalGetGradientClass` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-library/src/button/deprecated.js
  13:2  error  Usage of `__experimentalGetGradientClass` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-library/src/button/edit.js
  28:2  error  Usage of `__experimentalLinkControl` from `@wordpress/block-editor` is not allowed       @wordpress/no-unsafe-wp-apis
  29:2  error  Usage of `__experimentalUseEditorFeature` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-library/src/buttons/edit.js
  12:2  error  Usage of `__experimentalUseInnerBlocksProps` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-library/src/classic/edit.js
  183:4  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener
  187:4  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener

gutenberg/packages/block-library/src/column/edit.js
  15:2  error  Usage of `__experimentalUseInnerBlocksProps` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis
  19:2  error  Usage of `__experimentalUnitControl` from `@wordpress/components` is not allowed            @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-library/src/columns/edit.js
  15:2  error  Usage of `__experimentalUseInnerBlocksProps` from `@wordpress/block-editor` is not allowed   @wordpress/no-unsafe-wp-apis
  18:2  error  Usage of `__experimentalBlockVariationPicker` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-library/src/cover/deprecated.js
  15:2  error  Usage of `__experimentalGetGradientClass` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-library/src/cover/edit.js
  23:2  error  Usage of `__experimentalBoxControl` from `@wordpress/components` is not allowed                        @wordpress/no-unsafe-wp-apis
  35:2  error  Usage of `__experimentalUseInnerBlocksProps` from `@wordpress/block-editor` is not allowed             @wordpress/no-unsafe-wp-apis
  36:2  error  Usage of `__experimentalUseGradient` from `@wordpress/block-editor` is not allowed                     @wordpress/no-unsafe-wp-apis
  37:2  error  Usage of `__experimentalPanelColorGradientSettings` from `@wordpress/block-editor` is not allowed      @wordpress/no-unsafe-wp-apis
  38:2  error  Usage of `__experimentalUnitControl` from `@wordpress/block-editor` is not allowed                     @wordpress/no-unsafe-wp-apis
  39:2  error  Usage of `__experimentalBlockAlignmentMatrixToolbar` from `@wordpress/block-editor` is not allowed     @wordpress/no-unsafe-wp-apis
  40:2  error  Usage of `__experimentalBlockFullHeightAligmentToolbar` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-library/src/cover/edit.native.js
  44:2  error  Usage of `__experimentalUseGradient` from `@wordpress/block-editor` is not allowed       @wordpress/no-unsafe-wp-apis
  45:2  error  Usage of `__experimentalUseEditorFeature` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-library/src/cover/overlay-color-settings.native.js
  14:2  error  Usage of `__experimentalPanelColorGradientSettings` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis
  15:2  error  Usage of `__experimentalUseEditorFeature` from `@wordpress/block-editor` is not allowed            @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-library/src/cover/save.js
  12:2  error  Usage of `__experimentalGetGradientClass` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-library/src/file/edit.js
  11:2  error  Usage of `__unstableUseAnimate` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-library/src/group/edit.js
   8:2   error  Usage of `__experimentalUseInnerBlocksProps` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis
  10:10  error  Usage of `__experimentalBoxControl` from `@wordpress/components` is not allowed             @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-library/src/image/image.js
  27:2  error  Usage of `__experimentalImageSizeControl` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis
  28:2  error  Usage of `__experimentalImageURLInputUI` from `@wordpress/block-editor` is not allowed   @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-library/src/latest-posts/edit.js
  25:28  error  Usage of `__experimentalGetSettings` from `@wordpress/date` is not allowed               @wordpress/no-unsafe-wp-apis
  30:2   error  Usage of `__experimentalImageSizeControl` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-library/src/list/edit.js
  14:2  error  Usage of `__unstableCanIndentListItems` from `@wordpress/rich-text` is not allowed   @wordpress/no-unsafe-wp-apis
  15:2  error  Usage of `__unstableCanOutdentListItems` from `@wordpress/rich-text` is not allowed  @wordpress/no-unsafe-wp-apis
  16:2  error  Usage of `__unstableIndentListItems` from `@wordpress/rich-text` is not allowed      @wordpress/no-unsafe-wp-apis
  17:2  error  Usage of `__unstableOutdentListItems` from `@wordpress/rich-text` is not allowed     @wordpress/no-unsafe-wp-apis
  18:2  error  Usage of `__unstableChangeListType` from `@wordpress/rich-text` is not allowed       @wordpress/no-unsafe-wp-apis
  19:2  error  Usage of `__unstableIsListRootSelected` from `@wordpress/rich-text` is not allowed   @wordpress/no-unsafe-wp-apis
  20:2  error  Usage of `__unstableIsActiveListType` from `@wordpress/rich-text` is not allowed     @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-library/src/media-text/edit.js
  16:2  error  Usage of `__experimentalUseInnerBlocksProps` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis
  19:2  error  Usage of `__experimentalImageURLInputUI` from `@wordpress/block-editor` is not allowed      @wordpress/no-unsafe-wp-apis
  20:2  error  Usage of `__experimentalImageSizeControl` from `@wordpress/block-editor` is not allowed     @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-library/src/navigation-link/edit.js
  32:2  error  Usage of `__experimentalUseInnerBlocksProps` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis
  35:2  error  Usage of `__experimentalLinkControl` from `@wordpress/block-editor` is not allowed          @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-library/src/navigation/block-navigation-list.js
  4:10  error  Usage of `__experimentalBlockNavigationTree` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-library/src/navigation/edit.js
  13:2  error  Usage of `__experimentalUseInnerBlocksProps` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-library/src/paragraph/edit.js
  18:2  error  Usage of `__experimentalUseEditorFeature` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-library/src/post-comment-date/edit.js
  5:10  error  Usage of `__experimentalGetSettings` from `@wordpress/date` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-library/src/post-date/edit.js
  11:10  error  Usage of `__experimentalGetSettings` from `@wordpress/date` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-library/src/post-hierarchical-terms/edit.js
  15:2  error  Usage of `__experimentalBlockVariationPicker` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-library/src/query-loop/edit.js
  16:2  error  Usage of `__experimentalUseInnerBlocksProps` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-library/src/query/edit/index.js
  10:2  error  Usage of `__experimentalUseInnerBlocksProps` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-library/src/query/edit/query-placeholder.js
  7:2  error  Usage of `__experimentalBlockVariationPicker` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis
  8:2  error  Usage of `__experimentalGetMatchingVariation` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-library/src/query/edit/query-toolbar.js
  10:2  error  Usage of `__experimentalNumberControl` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-library/src/search/edit.js
  14:2  error  Usage of `__experimentalUnitControl` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-library/src/social-links/edit.js
  14:2  error  Usage of `__experimentalUseInnerBlocksProps` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-library/src/template-part/edit/inner-blocks.js
  7:2  error  Usage of `__experimentalUseInnerBlocksProps` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/block-library/src/template-part/edit/selection/index.js
  4:10  error  Usage of `__experimentalSearchForm` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/blocks/src/api/utils.js
  12:10  error  Usage of `__unstableStripHTML` from `@wordpress/dom` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/components/src/angle-picker-control/angle-circle.js
  5:10  error  Usage of `__experimentalUseDragging` from `@wordpress/compose` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/components/src/color-picker/alpha.js
  104:3  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener
  105:3  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener
  120:3  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener
  121:3  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener

gutenberg/packages/components/src/color-picker/hue.js
  102:3  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener
  103:3  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener
  118:3  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener
  119:3  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener

gutenberg/packages/components/src/color-picker/saturation.js
  114:3  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener
  115:3  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener
  130:3  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener
  131:3  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener

gutenberg/packages/components/src/custom-gradient-picker/control-points.js
  187:4   warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener
  188:4   warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener
  234:10  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener
  238:10  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener

gutenberg/packages/components/src/date-time/timezone.js
  5:10  error  Usage of `__experimentalGetSettings` from `@wordpress/date` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/components/src/focal-point-picker/index.js
  53:3  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener
  54:3  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener
  74:3  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener
  75:3  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener

gutenberg/packages/components/src/popover/index.js
  424:3  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener
  425:3  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener
  426:3  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener
  437:4  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener
  438:4  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener
  439:4  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener

gutenberg/packages/components/src/popover/stories/_utils.js
  32:3  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener
  33:3  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener
  35:4  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener
  36:4  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener

gutenberg/packages/components/src/range-control/tooltip.js
  74:3  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener
  77:4  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener

gutenberg/packages/components/src/tooltip/index.js
  62:3  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener

gutenberg/packages/components/src/utils/hooks/use-jump-step.js
  37:3  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener
  38:3  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener
  41:4  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener
  42:4  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener

gutenberg/packages/compose/src/higher-order/with-global-events/listener.js
  21:4  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener
  36:4  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener

gutenberg/packages/compose/src/hooks/use-dragging/index.js
  39:3  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener
  40:3  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener
  47:3  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener
  48:3  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener
  56:5  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener
  57:5  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener

gutenberg/packages/core-data/src/locks/actions.js
  4:10  error  Usage of `__unstableAwaitPromise` from `@wordpress/data-controls` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/date/src/test/index.js
  401:2  warning  Skipped test  jest/no-disabled-tests
  459:2  warning  Skipped test  jest/no-disabled-tests

gutenberg/packages/dom-ready/src/index.js
  40:2  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener

gutenberg/packages/edit-navigation/src/components/editor/list-view.js
  7:10  error  Usage of `__experimentalBlockNavigationTree` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/edit-navigation/src/index.js
  12:2  error  Usage of `__experimentalRegisterExperimentalCoreBlocks` from `@wordpress/block-library` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/edit-post/src/components/device-preview/index.js
  8:10  error  Usage of `__experimentalPreviewOptions` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/edit-post/src/components/header/main-dashboard-button/index.js
  5:2  error  Usage of `__experimentalUseSlot` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/edit-post/src/components/layout/index.js
  19:2  error  Usage of `__experimentalLibrary` from `@wordpress/block-editor` is not allowed      @wordpress/no-unsafe-wp-apis
  20:2  error  Usage of `__unstableUseEditorStyles` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/edit-post/src/components/layout/index.native.js
  14:2  error  Usage of `__experimentalPageTemplatePicker` from `@wordpress/block-editor` is not allowed      @wordpress/no-unsafe-wp-apis
  15:2  error  Usage of `__experimentalWithPageTemplatePicker` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/edit-post/src/components/visual-editor/index.js
  11:2  error  Usage of `__unstableUseBlockSelectionClearer` from `@wordpress/block-editor` is not allowed         @wordpress/no-unsafe-wp-apis
  12:2  error  Usage of `__unstableUseTypewriter` from `@wordpress/block-editor` is not allowed                    @wordpress/no-unsafe-wp-apis
  13:2  error  Usage of `__unstableUseClipboardHandler` from `@wordpress/block-editor` is not allowed              @wordpress/no-unsafe-wp-apis
  14:2  error  Usage of `__unstableUseTypingObserver` from `@wordpress/block-editor` is not allowed                @wordpress/no-unsafe-wp-apis
  15:2  error  Usage of `__unstableUseScrollMultiSelectionIntoView` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis
  16:2  error  Usage of `__experimentalBlockSettingsMenuFirstItem` from `@wordpress/block-editor` is not allowed   @wordpress/no-unsafe-wp-apis
  17:2  error  Usage of `__experimentalUseResizeCanvas` from `@wordpress/block-editor` is not allowed              @wordpress/no-unsafe-wp-apis
  18:2  error  Usage of `__unstableUseCanvasClickRedirect` from `@wordpress/block-editor` is not allowed           @wordpress/no-unsafe-wp-apis

gutenberg/packages/edit-post/src/index.js
   12:2  error    Usage of `__experimentalRegisterExperimentalCoreBlocks` from `@wordpress/block-library` is not allowed                        @wordpress/no-unsafe-wp-apis
  123:3  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener

gutenberg/packages/edit-site/src/components/block-editor/index.js
  10:2  error  Usage of `__experimentalLinkControl` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/edit-site/src/components/editor/index.js
  24:2  error  Usage of `__unstableUseEditorStyles` from `@wordpress/block-editor` is not allowed      @wordpress/no-unsafe-wp-apis
  25:2  error  Usage of `__experimentalUseResizeCanvas` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis
  26:2  error  Usage of `__experimentalLibrary` from `@wordpress/block-editor` is not allowed          @wordpress/no-unsafe-wp-apis

gutenberg/packages/edit-site/src/components/header/document-actions/index.js
  11:2  error  Usage of `__experimentalGetBlockLabel` from `@wordpress/blocks` is not allowed  @wordpress/no-unsafe-wp-apis
  19:2  error  Usage of `__experimentalText` from `@wordpress/components` is not allowed       @wordpress/no-unsafe-wp-apis

gutenberg/packages/edit-site/src/components/header/index.js
  9:2  error  Usage of `__experimentalPreviewOptions` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/edit-site/src/components/main-dashboard-button/index.js
  5:2  error  Usage of `__experimentalUseSlot` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/edit-site/src/components/navigation-sidebar/navigation-panel/content-navigation.js
  6:2  error  Usage of `__experimentalNavigation` from `@wordpress/components` is not allowed      @wordpress/no-unsafe-wp-apis
  7:2  error  Usage of `__experimentalNavigationMenu` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis
  8:2  error  Usage of `__experimentalNavigationItem` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/edit-site/src/components/navigation-sidebar/navigation-panel/menus/content-categories.js
  4:10  error  Usage of `__experimentalNavigationMenu` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/edit-site/src/components/navigation-sidebar/navigation-panel/menus/content-pages.js
  4:10  error  Usage of `__experimentalNavigationMenu` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/edit-site/src/components/navigation-sidebar/navigation-panel/menus/content-posts.js
  5:2  error  Usage of `__experimentalNavigationMenu` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis
  6:2  error  Usage of `__experimentalNavigationItem` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/edit-site/src/components/navigation-sidebar/navigation-panel/menus/template-parts.js
  12:2  error  Usage of `__experimentalNavigationMenu` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis
  13:2  error  Usage of `__experimentalNavigationItem` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/edit-site/src/components/navigation-sidebar/navigation-panel/menus/templates-all.js
  9:10  error  Usage of `__experimentalNavigationMenu` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/edit-site/src/components/navigation-sidebar/navigation-panel/menus/templates-pages.js
  10:2  error  Usage of `__experimentalNavigationGroup` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis
  11:2  error  Usage of `__experimentalNavigationMenu` from `@wordpress/components` is not allowed   @wordpress/no-unsafe-wp-apis

gutenberg/packages/edit-site/src/components/navigation-sidebar/navigation-panel/menus/templates-posts.js
  10:2  error  Usage of `__experimentalNavigationGroup` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis
  11:2  error  Usage of `__experimentalNavigationMenu` from `@wordpress/components` is not allowed   @wordpress/no-unsafe-wp-apis

gutenberg/packages/edit-site/src/components/navigation-sidebar/navigation-panel/menus/templates.js
  10:2  error  Usage of `__experimentalNavigationItem` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis
  11:2  error  Usage of `__experimentalNavigationMenu` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/edit-site/src/components/navigation-sidebar/navigation-panel/navigation-entity-items.js
  5:10  error  Usage of `__experimentalNavigationItem` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/edit-site/src/components/navigation-sidebar/navigation-panel/search-results.js
  10:10  error  Usage of `__experimentalNavigationGroup` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/edit-site/src/components/navigation-sidebar/navigation-panel/template-navigation-item.js
  6:2  error  Usage of `__experimentalNavigationItem` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/edit-site/src/components/navigation-sidebar/navigation-panel/templates-navigation.js
  5:2  error  Usage of `__experimentalNavigation` from `@wordpress/components` is not allowed            @wordpress/no-unsafe-wp-apis
  6:2  error  Usage of `__experimentalNavigationMenu` from `@wordpress/components` is not allowed        @wordpress/no-unsafe-wp-apis
  7:2  error  Usage of `__experimentalNavigationItem` from `@wordpress/components` is not allowed        @wordpress/no-unsafe-wp-apis
  8:2  error  Usage of `__experimentalNavigationBackButton` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/edit-site/src/components/sidebar/color-palette-panel.js
  9:10  error  Usage of `__experimentalColorEdit` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/edit-site/src/components/sidebar/color-panel.js
  4:10  error  Usage of `__experimentalPanelColorGradientSettings` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/edit-site/src/components/sidebar/typography-panel.js
  6:2  error  Usage of `__experimentalFontFamilyControl` from `@wordpress/block-editor` is not allowed      @wordpress/no-unsafe-wp-apis
  7:2  error  Usage of `__experimentalFontAppearanceControl` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/edit-site/src/components/template-details/index.js
  5:18  error  Usage of `__experimentalText` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/edit-site/src/index.js
  10:2  error  Usage of `__experimentalRegisterExperimentalCoreBlocks` from `@wordpress/block-library` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/edit-widgets/src/components/layout/interface.js
  8:2  error  Usage of `__experimentalLibrary` from `@wordpress/block-editor` is not allowed      @wordpress/no-unsafe-wp-apis
  9:2  error  Usage of `__unstableUseEditorStyles` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/edit-widgets/src/components/layout/unsaved-changes-warning.js
  46:3  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener
  49:4  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener

gutenberg/packages/edit-widgets/src/index.js
  12:2  error  Usage of `__experimentalGetCoreBlocks` from `@wordpress/block-library` is not allowed                   @wordpress/no-unsafe-wp-apis
  13:2  error  Usage of `__experimentalRegisterExperimentalCoreBlocks` from `@wordpress/block-library` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/editor/src/components/deprecated.js
  44:2  error  Usage of `__unstableRichTextInputEvent` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/editor/src/components/deprecated.native.js
  20:2  error  Usage of `__unstableRichTextInputEvent` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/editor/src/components/post-locked-modal/index.js
  133:3  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener
  138:4  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener

gutenberg/packages/editor/src/components/post-saved-state/index.js
  10:2  error  Usage of `__unstableUseAnimate` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/editor/src/components/post-schedule/index.js
  4:10  error  Usage of `__experimentalGetSettings` from `@wordpress/date` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/editor/src/components/post-schedule/label.js
  6:20  error  Usage of `__experimentalGetSettings` from `@wordpress/date` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/editor/src/components/post-title/index.native.js
  12:2  error  Usage of `__experimentalRichText` from `@wordpress/rich-text` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/editor/src/components/unsaved-changes-warning/index.js
  44:3  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener
  47:4  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener

gutenberg/packages/format-library/src/bold/index.js
  9:2  error  Usage of `__unstableRichTextInputEvent` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/format-library/src/italic/index.js
  9:2  error  Usage of `__unstableRichTextInputEvent` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/format-library/src/link/inline.js
  20:10  error  Usage of `__experimentalLinkControl` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/format-library/src/text-color/index.js
  13:2  error  Usage of `__experimentalUseEditorFeature` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/format-library/src/underline/index.js
  8:2  error  Usage of `__unstableRichTextInputEvent` from `@wordpress/block-editor` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/interface/src/components/interface-skeleton/index.js
  10:10  error  Usage of `__unstableUseNavigateRegions` from `@wordpress/components` is not allowed  @wordpress/no-unsafe-wp-apis

gutenberg/packages/list-reusable-blocks/src/index.js
  25:1  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener

gutenberg/packages/react-native-editor/__device-tests__/gutenberg-editor-block-insertion.test.js
   31:3  warning  Illegal usage of jasmine global  jest/no-jasmine-globals
   31:3  warning  Illegal usage of jasmine global  jest/no-jasmine-globals
   44:2  warning  Test has no assertions           jest/expect-expect
  114:2  warning  Test has no assertions           jest/expect-expect

gutenberg/packages/react-native-editor/__device-tests__/gutenberg-editor-columns.test.js
  24:3  warning  Illegal usage of jasmine global  jest/no-jasmine-globals
  24:3  warning  Illegal usage of jasmine global  jest/no-jasmine-globals

gutenberg/packages/react-native-editor/__device-tests__/gutenberg-editor-cover.test.js
  29:3  warning  Illegal usage of jasmine global  jest/no-jasmine-globals
  29:3  warning  Illegal usage of jasmine global  jest/no-jasmine-globals

gutenberg/packages/react-native-editor/__device-tests__/gutenberg-editor-gallery.test.js
  23:3  warning  Illegal usage of jasmine global  jest/no-jasmine-globals
  23:3  warning  Illegal usage of jasmine global  jest/no-jasmine-globals

gutenberg/packages/react-native-editor/__device-tests__/gutenberg-editor-heading.test.js
  30:3  warning  Illegal usage of jasmine global  jest/no-jasmine-globals
  30:3  warning  Illegal usage of jasmine global  jest/no-jasmine-globals
  42:2  warning  Test has no assertions           jest/expect-expect

gutenberg/packages/react-native-editor/__device-tests__/gutenberg-editor-image.test.js
  32:3  warning  Illegal usage of jasmine global  jest/no-jasmine-globals
  32:3  warning  Illegal usage of jasmine global  jest/no-jasmine-globals
  44:2  warning  Test has no assertions           jest/expect-expect

gutenberg/packages/react-native-editor/__device-tests__/gutenberg-editor-latest-posts.test.js
  23:3  warning  Illegal usage of jasmine global  jest/no-jasmine-globals
  23:3  warning  Illegal usage of jasmine global  jest/no-jasmine-globals

gutenberg/packages/react-native-editor/__device-tests__/gutenberg-editor-lists-canary.test.js
  29:3  warning  Illegal usage of jasmine global  jest/no-jasmine-globals
  29:3  warning  Illegal usage of jasmine global  jest/no-jasmine-globals
  41:2  warning  Test has no assertions           jest/expect-expect
  71:2  warning  Test has no assertions           jest/expect-expect

gutenberg/packages/react-native-editor/__device-tests__/gutenberg-editor-lists-end.test.js
  29:3  warning  Illegal usage of jasmine global  jest/no-jasmine-globals
  29:3  warning  Illegal usage of jasmine global  jest/no-jasmine-globals
  41:2  warning  Test has no assertions           jest/expect-expect

gutenberg/packages/react-native-editor/__device-tests__/gutenberg-editor-lists.test.js
  29:3  warning  Illegal usage of jasmine global  jest/no-jasmine-globals
  29:3  warning  Illegal usage of jasmine global  jest/no-jasmine-globals
  42:2  warning  Test has no assertions           jest/expect-expect

gutenberg/packages/react-native-editor/__device-tests__/gutenberg-editor-more.test.js
  23:3  warning  Illegal usage of jasmine global  jest/no-jasmine-globals
  23:3  warning  Illegal usage of jasmine global  jest/no-jasmine-globals

gutenberg/packages/react-native-editor/__device-tests__/gutenberg-editor-paragraph.test.js
   32:3  warning  Illegal usage of jasmine global  jest/no-jasmine-globals
   32:3  warning  Illegal usage of jasmine global  jest/no-jasmine-globals
   44:2  warning  Test has no assertions           jest/expect-expect
  153:2  warning  Test has no assertions           jest/expect-expect

gutenberg/packages/react-native-editor/__device-tests__/gutenberg-editor-paste.test.js
  22:3  warning  Test has no assertions           jest/expect-expect
  39:3  warning  Illegal usage of jasmine global  jest/no-jasmine-globals
  39:3  warning  Illegal usage of jasmine global  jest/no-jasmine-globals
  96:2  warning  Test has no assertions           jest/expect-expect

gutenberg/packages/react-native-editor/__device-tests__/gutenberg-editor-rotation.test.js
  30:3  warning  Illegal usage of jasmine global  jest/no-jasmine-globals
  30:3  warning  Illegal usage of jasmine global  jest/no-jasmine-globals
  42:2  warning  Test has no assertions           jest/expect-expect

gutenberg/packages/react-native-editor/__device-tests__/gutenberg-editor-separator.test.js
  23:3  warning  Illegal usage of jasmine global  jest/no-jasmine-globals
  23:3  warning  Illegal usage of jasmine global  jest/no-jasmine-globals

gutenberg/packages/react-native-editor/__device-tests__/gutenberg-editor-spacer.test.js
  23:3  warning  Illegal usage of jasmine global  jest/no-jasmine-globals
  23:3  warning  Illegal usage of jasmine global  jest/no-jasmine-globals

gutenberg/packages/react-native-editor/__device-tests__/gutenberg-editor-unsupported-blocks.test.js
  23:3  warning  Illegal usage of jasmine global  jest/no-jasmine-globals
  23:3  warning  Illegal usage of jasmine global  jest/no-jasmine-globals

gutenberg/packages/react-native-editor/__device-tests__/gutenberg-editor-verse.test.js
  23:3  warning  Illegal usage of jasmine global  jest/no-jasmine-globals
  23:3  warning  Illegal usage of jasmine global  jest/no-jasmine-globals

gutenberg/packages/viewport/src/listener.js
  56:2  warning  Avoid using (add|remove)EventListener with globals. Use `ownerDocument` or `ownerDocument.defaultView` on a node ref instead  @wordpress/no-global-event-listener

gutenberg/test/integration/full-content/full-content.test.js
  20:2  error  Usage of `__experimentalRegisterExperimentalCoreBlocks` from `@wordpress/block-library` is not allowed  @wordpress/no-unsafe-wp-apis

✖ 275 problems (161 errors, 114 warnings)

Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

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

This is really cool and the proposed configuration is excellent:

  • disabled in Gutenberg
  • errors for external usage of @wordpress/eslint-plugin

It will give feedback whenever someone tries to use those experimental APIs which otherwise could be misunderstood.

One note, it would be good to link to some documentation when showing an error.

sirreal added a commit to Automattic/wp-calypso that referenced this pull request Nov 26, 2020
Based on improvements in WordPress/gutenberg#27301
@sirreal
Copy link
Member Author

sirreal commented Nov 27, 2020

it would be good to link to some documentation when showing an error.

Agreed… do you think a link to the rule's documentation, or to the documentation on experimental and unstable features?

@sirreal sirreal changed the title Eslint: Add recommended rule to prohibit unsafe APIs Eslint: Add rule to prohibit unsafe APIs Nov 27, 2020
@gziolo
Copy link
Member

gziolo commented Nov 27, 2020

it would be good to link to some documentation when showing an error.

Agreed… do you think a link to the rule's documentation, or to the documentation on experimental and unstable features?

How about this one: https://developer.wordpress.org/block-editor/contributors/develop/coding-guidelines/#experimental-and-unstable-apis?

Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

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

Now that this rule isn't in use, according to what we discussed in https://github.com/WordPress/gutenberg/pull/27301/files#r531074490, we can merge it and start playing with it in external projects.

Limitations: This is limited to imported names from @wordpress/* modules. This covers some of the features, but will not prevent usage of experimental or unstable APIs that do not appear as imported names. For example, this would not cover component properties like <MyComponent __experimentalProp={ true } />.

The usage in JSX would be quite a good candidate to enhance this rule in the future. Another use case I can think of is select or dispatch calls (and their counterparts) that use selectors and actions. Although the latter is quite challenging to process.

@gziolo gziolo added [Type] New API New API to be used by plugin developers or package users. and removed [Type] Enhancement A suggestion for improvement. labels Nov 27, 2020
@gziolo gziolo merged commit 2e593cd into master Nov 27, 2020
@gziolo gziolo deleted the add/eslint-no-unsafe-rule branch November 27, 2020 14:55
@github-actions github-actions bot added this to the Gutenberg 9.5 milestone Nov 27, 2020
@sirreal
Copy link
Member Author

sirreal commented Nov 27, 2020

The usage in JSX would be quite a good candidate to enhance this rule in the future. Another use case I can think of is select or dispatch calls (and their counterparts) that use selectors and actions. Although the latter is quite challenging to process.

Yes, it's more difficult. I wonder no-restricted-syntax would work, at the very least there's surely good inspiration for the implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
npm Packages Related to npm packages [Tool] ESLint plugin /packages/eslint-plugin [Type] New API New API to be used by plugin developers or package users.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants